Andreas
Andreas

Reputation: 309

Autodesk BIM360: Folder Creation returns 400 Bad request

I called the POST-Folder Method via Postman with a JSON body according to this example. But I only receive the message "400 Bad Request" without any explanations. This is what my request looks like:

The service adress:

https://developer.api.autodesk.com/data/v1/projects/b.5823d0b2-0000-0000-00/commands

The HTTP-header

Authorization: Bearer 2_legged_token
Content-Type:  application/vnd.api+json

The JSON-Body

{
   "jsonapi": {
      "version": "1.0"
   },
   "data": {
      "type": "commands",
      "attributes": {
         "extension": {
            "type": "commands:autodesk.core:CreateFolder",
            "version": "1.0.0",
            "data": {
               "requiredAction": "create"
            }
         }
      },
      "relationships": {
         "resources": {
            "data": [
               {
                  "type": "folders",
                  "id": "1"
               }
            ]
         }
      }
   },
   "included": [
      {
         "type": "folders",
         "id": "1",
         "attributes": {
            "name": "test",
            "extension": {
               "type": "folders:autodesk.bim360:Folder",
               "version": "1.0.0"
            }
         },
         "relationships": {
            "parent": {
               "data": {
                  "type": "folders",
                  "id": "urn:adsk.wipprod:fs.folder:co.Ai*****"
               }
            }
         }
      }
   ]
}

The response

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "f1266e76-a37e-400b-bff6-de84b11cdb00",
            "status": "400",
            "detail": "BadRequest"
        }
    ]
}

What I have found out so far:

Upvotes: 0

Views: 308

Answers (1)

Augusto Goncalves
Augusto Goncalves

Reputation: 8604

As of now, you can create a BIM 360 Docs Folder with commands endpoints, as you pointed out. For that you can use:

  • 3-legged token
  • 2-legged token with x-user-id header, this should contain the Autodesk User ID obtained, for instance, from GET users@me endpoint
  • "pure" 2-legged token will return bad request (as of August/2017)

Sorry about the documentation, the endpoint to create BIM 360 Docs folder via Commands was released a couple weeks back and we're just finishing to write the documentation.

Upvotes: 1

Related Questions