I want to get notification when a model translate job finishes using webhook api. It works well when I post a translate job using Postman. But if I post a translate job using axios(with nodejs). I can't receive message when the translation is done.
I POST webhook using:
https://developer.api.autodesk.com/webhooks/v1/systems/derivative/events/extraction.finished/hooks
and when I get hooks, it returns this:
{
"hookId": "2d2521f8-6313-479b-afb4-fdb0362cbdd7",
"tenant": "myWorkflow",
"callbackUrl": "https://webhook.site/6d874bda-ee95-4407-9152-0214b0367a3d",
"createdBy": "1AuvzJaXZA9koZLNwdTWjoBtEKkU0nbI",
"event": "extraction.finished",
"createdDate": "2023-02-21T08:27:05.317+00:00",
"lastUpdatedDate": "2023-02-21T08:27:05.310+00:00",
"system": "derivative",
"creatorType": "Application",
"status": "active",
"scope": {
workflow": "myWorkflow"
},
"autoReactivateHook": false,
"urn": "urn:adsk.webhooks:events.hook:2d2521f8-6313-479b-afb4-fdb0362cbdd7",
"callbackWithEventPayloadOnly": false,
"__self__": "/systems/derivative/events/extraction.finished/hooks/2d2521f8-6313-479b-afb4-fdb0362cbdd7"
}
I POST https://{{ForgeURL}}/modelderivative/v2/designdata/job
using Postman and it worked well.I can receive message when translate finished.
But when I tried to POST translate job using axios. the webhook didn't trigger. Here's my function for posting a translate job:
async function postTranslateJob(urn) {
const token = await <get my token>;
const url = 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job';
const body = {
"input": {
"urn": urn
},
"output": {
"formats": [
{
"type": "svf2",
"views": [
"2d",
"3d"
]
}
]
},
"misc": {
"workflow": "myWorkflow"
}
}
const config = {
'headers': {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
'x-ads-force': true
}
}
const resp = await axios.post(url, body, config);
return resp.data;
}
when I post it. it returns:
{
"result": "success",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6MWF1dnpqYXh6YTlrb3psbndkdHdqb2J0ZWtrdTBuYmkyMDIzMDIwMXQxMDE4NTU1NDF6LzIwMTkxMTI5JUU1JThGJUIwJUU1JThEJTk3JUU3JUFGJTg5JUU3JTlEJUJGJUU3JUE3JTkxJUU2JThBJTgwUC0wOC5wZGY",
"acceptedJobs": {
"output": {
"formats": [
{
"type": "svf2",
"views": [
"2d",
"3d"
]
}
]
}
}
}
translate job seems to be okay, and the urn I provide has been translated. but it doesn't trigger the webhook when the job is done. There's no error messages or warnings. I have no idea why. Is there something wrong?