20 Dec 2017
Practice with WebHook by RequestBin
WebHook API beta has been released. My colleagues have introduced the API and demos.
- Autodesk Forge Data Management Now Features WebHooks
- Webhooks for Data Management API - NodeJS sample
The API document shows how to get started with WebHook step by step. In Configuring your Local Server, ngrok is recommended. While sometimes, we just need to check the response of WenHook it it contains the data we need, and merge the logic to our project. So at the beginning when I learnt WebHook, I selected the simple tool RequestBin. RequestBin gives you a URL that will collect requests made to it and let you inspect them in a human-friendly way
One friend David McSweeney kindly reminded me the original hosted version of RequestBin (at requestb.in) was taken down last year. There's a new hosted version, with some additional features (including enhanced privacy) at https://requestbin.com. I did a quick test, it looks more beautiful and easy to use than before. Thank you much David!
Firstly, assume we have a folder in Fusion Team or Autodesk 360 or BIM 360 and have got the folder Id urn by some other ways.
Next, create a monitor page RequestBin. just click [Create a Request Bin]. Make a note with the monitor endpoint, such as https://enh6zhped3br.x.pipedream.net in this snapshot.
In Postman, we produce some scripts:
1. get 3 legged token. This is a typical script to authorize an application to access the data of Fusion team and Autodesk 360.
2. post script to create a WebHook such as file.added, with the folder id and the monitor url of RequestBin.
Now, let us add a new file in the folder of Autodesk 360 or Fusion Team or BIM 360, click the POST requests that appear in the left panel, the responses will be listed in the page, including the header and body. The body tells all information about the folder, user, file, etc. From that, we could know which kind of data we could get out and the data structure.