Download a Document with Autodesk API

喜夏-厌秋 提交于 2019-12-02 07:51:59

问题


I'm trying to download documents from BIM 360 Docs. If I want to download a file with the type "type": "items:autodesk.bim360:File" I just need to get the bucketID and objectID (/projects/<projectID>/items/<itemID>) and call buckets/<bucketID>/objects/<ObjectID>. (I used this tutorial)

But how do I download a file with the type "type": "items:autodesk.bim360:Document"?

First, I get the version of the document /projects/<projectID>/items/<itemID>/versions. After that I call projects/<ProjectID>/versions/<versionID>/downloadFormats but it returns an empty JSON. The call projects/<ProjectID>/versions/<versionID>/downloads returns a 400 Bad Input. Whats the right way to get the bucket & objectID from a "document"? The way from the tutorial doesn't work because there is no "storage" tag in the JSON (example).


回答1:


For BIM 360 Project Folder items, follow the tutorial here to download document.

Basically you will need to obtain the URN of the document from the relationships.storage.data.id field via GET projects/:project_id/folders/:folder_id/contents.

For item type items:autodesk.bim360:Document, call GET projects/:project_id/versions/:version_id/relationships/refs to obtain the storage locations:

 "storage": {
          "meta": {
            "link": {
              "href": "/oss/v2/buckets/wipbucket/objects/urn:adsk.objects:os.object:wip.dm.prod%2F9f8bdc3f-e29c-4ada-ab7b-bb8dfa821163.pdf"
            }
          }

See doc here.



来源:https://stackoverflow.com/questions/54978434/download-a-document-with-autodesk-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!