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
Firstly, assume we have a folder in Fusion Team or Autodesk 360 and have got the folder urn by some other ways. Next, create a monitor page RequestBin. just click [Create a RequestBin]. Make a note with the monitor endpoint, such as https://requestb.in/txo1pbtx 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.modified, with the folder id and the monitor url of RequestBin.
Now, let us change the file name in the folder of Fusion Team, e.g. change test.log to test-new.log, then refresh the page of RequestBin endpoint, 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.