使用 Autodesk API 下载文档 [英] Download a Document with Autodesk API
问题描述
我正在尝试从 BIM 360 Docs 下载文档.如果我想下载类型为 "type": "items:autodesk.bim360:File"
的文件,我只需要获取 bucketID 和 objectID (/projects/
) 并调用 buckets/
.(我使用了本教程)
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)
但是如何下载类型为 "type": "items:autodesk.bim360:Document"
的文件?
But how do I download a file with the type "type": "items:autodesk.bim360:Document"
?
首先,我获取文档/projects/
的版本.之后我调用 projects/
但它返回一个空的 JSON.调用 projects/
返回 400 Bad Input.获取水桶的正确方法是什么?objectID 来自文档"?教程中的方法不起作用,因为 JSON 中没有存储"标签(example).
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).
推荐答案
对于 BIM 360 项目文件夹项,请按照教程 这里下载文档.
For BIM 360 Project Folder items, follow the tutorial here to download document.
基本上,您需要通过 GET projects/:project_id/folders/:folder_id/contents
字段从 relationships.storage.data.id
字段中获取文档的 URN>.
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
.
对于item类型items:autodesk.bim360:Document,调用GET projects/:project_id/versions/:version_id/relationships/refs
获取存储位置:
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"
}
}
参见文档 这里.
这篇关于使用 Autodesk API 下载文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!