BIM 360 Docs unable to rename file

BIM 360 Docs unable to rename file

Anonymous
Not applicable
1,205 Views
2 Replies
Message 1 of 3

BIM 360 Docs unable to rename file

Anonymous
Not applicable

I'm following this documentation to issue a PATCH request to rename a file and am unable to do so. The json that I'm sending contains the same information as that shown in the provided example.

The request URL is: 

https://developer.api.autodesk.com/data/v1/projects/b.cdf76e47-1150-4515-967b-34e7026d5f87/items/urn...

 

The json being sent is:

{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:ReIwr5xORACKkizhFMY17A",
"attributes": {
"displayName": "newName.txt"
}
}

 

The response is:

{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "19b22ae6-b3a6-4206-aa1b-5fd4a4ec9198",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request input is invalid for this operation."
}
]
}

 

Please provide guidance on how to perform the file rename.

Thank you,

John

 

0 Likes
Accepted solutions (1)
1,206 Views
2 Replies
Replies (2)
Message 2 of 3

eason.kangEDLV4
Autodesk Support
Autodesk Support

Hi Jhon,

 

I'm checking with our engineering team for a proper way to rename Docs items, and will get you back A.S.A.P.

 

Thanks,


Eason Kang
Developer Advocate
Developer Advocacy & Support Service
Autodesk Platform Service (formerly Forge)

0 Likes
Message 3 of 3

eason.kangEDLV4
Autodesk Support
Autodesk Support
Accepted solution

Hi Jhon,

 

Unfortunately, PATCH APIs are not supported for BIM360 Docs currently according to our team. To change item name, please try to create a new tip version instead like the below. Note. Both name and displayName of the new version will be set to NEW_FILENAME.

 

 

curl -v 'https://developer.api.autodesk.com/data/v1/projects/{PROJECT_ID}/versions?copyFrom={URL_ESCAPED_SOURCE_VERSION_URN}'
  -X POST \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/vnd.api+json"
  -d '{
        "jsonapi": {
          "version": "1.0"
        },
        "data": {
          "type": "versions",
          "attributes": {
            "name": "{NEW_FILENAME}"
          }
        }
      }'

 

 

For example, I want to change the DWG filename. Here is the item info:

  • Version urn: urn:adsk.wipprod:fs.file:vf.n1FzuIStRbes8GuAT0wDGw?version=2
  • URL escaped version urn: urn:adsk.wipprod:fs.file:vf.n1FzuIStRbes8GuAT0wDGw%3Fversion=2
  • Origin filename: rac_basic_sample_project-Level 1-Floor Plan - Level 1.dwg 
  • New filename: FPD rac_basic_sample_project-Level 1-Floor Plan - Level 1.dwg

 

 

curl -v 'https://developer.api.autodesk.com/data/v1/projects/b.61f05d07-10f7-4252-a9ad-cbca5d7ee102/versions?copyFrom=urn:adsk.wipprod:fs.file:vf.n1FzuIStRbes8GuAT0wDGw%3Fversion=2'
  -X POST \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/vnd.api+json"
  -d '{
        "jsonapi": {
          "version": "1.0"
        },
        "data": {
          "type": "versions",
          "attributes": {
            "name": "FPD rac_basic_sample_project-Level 1-Floor Plan - Level 1.dwg"
          }
        }
      }'

 

Ref: https://developer.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/

 

Hope it helps.

 

Cheers,

 

 

 


Eason Kang
Developer Advocate
Developer Advocacy & Support Service
Autodesk Platform Service (formerly Forge)

0 Likes