30 Aug 2024
Parse Webhook response of modified event for different file types
Webhook supports the translation progress of BIM360 or ACC files, among them, one is dm.version.modified event. When you subscribe to this event, you will recieve multiple calls from our webhook service, and the response varies on file type as well. This becomes confusing in determining the final modified event for different file types. In this blog, we'll show what to look for in the webhook body to determine the final event based on the file type.
The first thing to check is supported translations, which show a list of supported source file formats and the derivative formats they can be translated to. As you can see, we don't translate PNG or text files into SVF2, so the webhook response will differ slightly.
Typical webhook response body:
{
"version": "1.0",
"resourceUrn": "<<version_URN>>",
"hook": {
"hookId": "<<hook_Id>>",
....
....
},
"payload": {
"ext": "dwg",
....
....
"custom-metadata": {
"storm:svf2-extraction-state": "PROCESSING_COMPLETE",
....
....
"storm:entity-type": "SEED_FILE",
"storm:process-state": "PROCESSING_COMPLETE",
....
}
}
}
storm:process-state can have different values like, 'NEEDS_PROCESSING', 'PROCESSING', 'EXTRACTION_PENDING', and finally 'PROCESSING_COMPLETE'. Till now it's obvious that we have to wait till we get storm:process-state as 'PROCESSING_COMPLETE'.
The confusion comes when the file type changes. To determine the final event, in the case of design files like DWG, IFC, etc, in the webhook response, response.payload['custom-metadata'], we have to wait for both storm:svf2-extraction-state and storm:process-state to be "PROCESSING_COMPLETE". For other files like jpg, png, etc, "storm:process-state": "PROCESSING_COMPLETE" is enough, because we're not converting those to SVF2.
For PDF it's a bit different, even though we support the translation into SVF2, the webhook response is slightly different compared to native Design files like DWG. Here we have to wait for "storm:process-state" and "storm:metadata-extraction-state" to be "PROCESSING_COMPLETE".
This information should be useful to confirm the translations or modifications of different file types.