0

Our team is working with Autodesk Construction Cloud and it's Docs module quite heavily. Because of that we're trying to develop some internal tools which would automate some work that they do, mostly around copying files.

In ACC Docs you can easily copy files from one folder to another. From our investigation it looks like the ACC internally uses an endpoint like this to copy the files:

https://developer.api.autodesk.com/dm/v3/projects/{{projectId}}/documents:copy?targetFolder={{targetFolder}}

By using the authentication token from ACC requests (obtained from the browser), we can easily use this call from Postman or even an AWS Lambda function. But when we're using the auth tokens obtained from 3-legged auth process as described in the documentation, the same API call fails.

Is it even possible right now to obtain an auth token which works with that endpoint for copying ACC Docs files? Or is this not available right now as this API is still not really "public"?

maleficca
  • 35
  • 7

1 Answers1

2

Happy New Year!

Those APIs are internal APIs. Please do not try to use them. even if it may work, you would use it on your own risk..

Regarding with copy files files from one folder to the other, you can use the public API. After you get the version urn of the original file, call the endpoint below with the parameter

POST https://developer.api.autodesk.com/data/v1/projects/{PROJECT_ID}/items?copyFrom=urn%3Aadsk.wipprod%3Afs.file%3Avf.rH_L4XJsTmeiYA4ixCVNAA%3Fversion%3D1

with the payload, in which specify the target folder.

{
"jsonapi": {
 "version": "1.0"
},
"data": {
 "type": "items",
 "relationships": {
  "tip":{
        "data":{
           "type":"versions",
           "id":"1"
        }
     },
     "parent": {
         "data": {
             "type": "folders",
             "id": "urn:adsk.wipprod:fs.folder:co.0xaYa2rVTJuFiz7rxLCOQQ"  
//!<<< The folder we want to put this file
         }
     }
 }
 },
"included":[
  {
     "type":"versions",
        "id":"1",
        "attributes":{
           "name":"rac_basic_sample_project.rvt"   //!<<< Version name
        }
  }
  ]
}
Xiaodong Liang
  • 2,051
  • 2
  • 9
  • 14
  • Happy New Year! Unfortunately this does not solve my problem fully, as this endpoint does not allow for copying files between two different projects. Is there any way to do that without getting an error from the API? I know an intermediate solution of downloading the files first and then uploading it to the second project, but that way is very data heavy. – maleficca Jan 05 '23 at 20:45