4 Dec 2017

How PATCH APIs work and some tips for using PATCH APIs

Default blog image

We have a couple of questions related to PATCH APIs continuously, it’s not clear how PATCH API works with different Autodesk Applications. Here is a short summary and some tips about how they work.

1st of all, though PATCH APIs are Data Management APIs, they are not working for all the Autodesk SaaS applications. Currently, these APIs are working good for A360 Personal, BIM360 Team, Fusion Team. But unfortunately, they are not supported or encouraged for BIM 360 Docs, there might be a chance that allows for a folder rename, but it does not properly update the Docs database. So we do not recommend to use that API for BIM 360 Docs.

Now, here are the endpoints of the 3 PATCH APIs:

PATCH to folder:                 PATCH projects/:project_id/folders/:folder_id

PATCH to item:                   PATCH projects/:project_id/items/:item_id                     

PATCH to version:             PATCH projects/:project_id/versions/:version_id                  

You can use these APIs to update the information of version, item and folder, it should be pretty straightforward and similar, I won’t go through them. But there is one issue of PATCH to version API, the URI parameter of version_id has to be URL encoded, and this is the only parameter which requires to be URL encoded. It’s not clear mentioned in the document, and you will get "400" error with “Urn is not in the proper format” if you don't encode the version_id. The reason why this "version_id" is so special is because version id is usually like "urn:adsk.wipprod:fs.file:vf.isl4XeKhTq-GPbs7XGnq9A?version=2", there is "?version=2" at the end, if it's not encoded, it will be recognized as a query. 

Here is my payload, and it’s working successfully to change the name of the file version in A360.

PATCH to Version API payload

Some other tips:

  • If you want to change the file name in BIM360 Docs using API, as we mentioned above, you cannot use PATCH API, the workaround is to upload a new file version with your new name.
  • Sometimes, people try to change the file name using PATCH to item API, it’s not correct, you need to use PATCH to version API.

 

 

Related Article