Search code examples
postmanautodesk-forgeautodesk-data-managementautodesk-construction-cloudworkato

Autodesk ACC API Error 400: One or more input values in the request were bad - PATCH projects/:project_id/items/:item_id


I want to send a PATCH request using Autodesk Construction Cloud (ACC) API using Workato to update an attribute of a file/document (E.g.: displayName) but keep encounter a 400 error:

One or more input values in the request were bad\",\"detail\":\"Request input is invalid for this operation.

to refer to the image below of the error:

Error 400: One or more input values in the request were bad

but referring to the ACC api documentation

I'm already doing it as per the documentation still encounter 400 error no matter what

Below is the screenshot of how I do the PATCH request in Postman which still also encounter the 400 error:

Sending a patch request but encounter 400 error

Headers for the request in Postman

curl -v
'https://developer.api.autodesk.com/data/v1/projects/:project_id/items/:item_id'  
-X 'PATCH'  
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a'  
-H 'Content-Type: application/vnd.api+json'  
-d '{
        "jsonapi": {
          "version": "1.0"
        },
        "data": {
          "type": "items",
          "id": ":item_id",
          "attributes": {
            "displayName": "new name for drawing.dwg"
          }
        }
      }'

What is the correct way to do the PATCH request?


Solution

  • Unfortunately, renaming via the PATCH endpoint doesn't support BIM360 & ACC files. To do so, please use the POST version instead.

    curl --location 'https://developer.api.autodesk.com/data/v1/projects/{{projectId}}/versions?copyFrom={{encodedVerionId}}' \
    --header 'Authorization: Bearer ...' \
    --header 'Content-Type: application/vnd.api+json' \
    --data '{
      "jsonapi": {
        "version": "1.0"
      },
      "data": {
        "type": "versions",
        "attributes": {
          "name": "newName"
        }
      }
    }'
    

    Note. Both name and displayName will be updated to the newName.

    See also: