I am trying to download file from Autodesk BIM360 Doc (https://docs.b360.autodesk.com) with the Forge API so the files can be then afterward archieved to our local storage.
I have managed to download any files from "Project Files" folder using the data management API https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-GET/, with which i can get the storage id under data.relationships.storage.data.id.
however with the same API i cannot get the storage Id when querying files under "Plan" folder,
So is there any way with Forge API we can download a file from Plan folder? any help is appreciated.
The item listed in the Plan folder is a type of items:autodesk.bim360:Document
, this type item won't have storage attribute shown in its responses of GET versions/:version_id and GET items/:item_id directly.
To obtain the physical file location, you should call GET versions/:version_id/relationships/refs instead, see here for the similar thread: Download a Document with Autodesk API
Update for copied item
While accessing the relationship data of version of the copied item via GET versions/:version_id/relationships/refs, you would see a data attribute telling the relationship between the copied item and the source item with my experience:
"data": [
{
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.34Xvlw1jTcSQ_XkIVh07cg?version=2",
"meta": {
"refType": "derived",
"fromId": "urn:adsk.wipprod:fs.file:vf.34Xvlw1jTcSQ_XkIVh07cg?version=2",
"fromType": "versions",
"toId": "urn:adsk.wipprod:fs.file:vf.y3L7YbfAQJWwumMgqjJUxg?version=1",
"toType": "versions",
"direction": "to",
"extension": {
"type": "derived:autodesk.bim360:CopyDocument",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/derived:autodesk.bim360:CopyDocument-1.0"
},
"data": {}
}
}
}
],
Afterward, you have to access the version relationship dat of the fromId
via calling GET versions/:version_id/relationships/refs.
In this case, it's {PROJ_ID}/versions/urn:adsk.wipprod:fs.file:vf.34Xvlw1jTcSQ_XkIVh07cg%3Fversion=2/relationships/refs
, then you will see the storage
attribute inside the response with my investigation.