0

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?

TomTomTom
  • 28
  • 6
  • For the postman case, did you create the workflowId using https://aps.autodesk.com/en/docs/webhooks/v1/tutorials/create-a-hook-model-derivative/#step-4-create-a-webhook – Augusto Goncalves Feb 28 '23 at 00:30
  • yes,I created the hook using this endpoint. and I follow the tutorials step by step but only working well on postman. – TomTomTom Mar 02 '23 at 06:06
  • that part is missing in the above code, so cannot review it. Are you able to add it? – Augusto Goncalves Mar 03 '23 at 22:34
  • Thx for your response. I figured it out that webhook won't trigger when translate to `SVF2`. I've already submit this issue and my logs by sending mail to aps.help. now I use `SVF` instead of `SVF2` temporarily. – TomTomTom Mar 10 '23 at 07:20

0 Answers0