0

When creating a webhook for a BIM360 Team project, I get the error "Access denied for the scope a.123456789 that you are trying to create hook on" when creating with the project id with the below json body and request:

https://developer.api.autodesk.com/webhooks/v1/systems/data/events/dm.version.added/hooks

   {
       "callbackUrl": "http://test.com/callback",
       "scope": {
            "folder": "a.123456789"
         }
    }

This does succeed if a top folder URN is replaced in the json. I have tried with both 2-legged and 3-legged OAuth with data:create scope. Is there something I am missing?

2 Answers2

1

I noticed two things:

  1. According to API reference folder member in json encoded request body should be project or folder id represented by full urn. Something like this: urn:adsk.wipprod:fs.folder:a.123456789. It seems that you are sending only folder id part in your example.
  2. You mentioned that you are using OAuth token with data:create scope. You will need data:read scope as well.

Documentation is a bit ambiguous about the scope. According to this tutorial data:read is needed for all requests plus data:create to create a hook. Reference mentions data:read + data:write instead. Just go with all three to be sure, at least till you make it work.

Update after Mandi's comment

Well, now I see that my answer is misleading. Projects do not have id in urn form. According to Webhooks Field Guide: "Please note that, for purpose of Webhooks, Projects are also identified by their Folder URN". It is not completely clear from the documentation but it is probably project's root folder: data.relationships.rootFolder in JSON data.

So if you check Project example object in Data Management Field Guide, id is probably here:

"rootFolder": {
    "data": {
      "type": "folders",
      "id": "urn:adsk.wipprod:dm.folder:hC6k4hndRWaeIVhIjvHu8w"
    },
Jadranko
  • 13
  • 4
  • Thank you for your response. #2 is already applied to the scope. For #1, I only know of the Forge DM apis use ProjectId's in the form of a.123456789, not a full URN as you specify. What would be the actual syntax for that URN? urn:adsk:wipprod:fs:project:a.123456789? – Mandi Bishop Aug 24 '18 at 19:04
0

@MandiBishop, adding to @Jadranko's answer, the Webhook API supports ONLY folders, so you must provide a Folder ID. Indeed the documentation is not clear and I have logged a request to improve it. Sorry about this confusion.

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44