使用Autodesk API下载文档 [英] Download a Document with Autodesk API

查看:180
本文介绍了使用Autodesk API下载文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从BIM 360 Docs下载文档.如果要下载类型为"type": "items:autodesk.bim360:File"的文件,我只需要获取bucketID和objectID(/projects/<projectID>/items/<itemID>)并调用buckets/<bucketID>/objects/<ObjectID>. (我使用了教程)

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/<projectID>/items/<itemID>/versions的版本.之后,我调用projects/<ProjectID>/versions/<versionID>/downloadFormats,但是它返回一个空的JSON.呼叫projects/<ProjectID>/versions/<versionID>/downloads返回400错误的输入.什么是拿到桶的正确方法?来自文档"的objectID?本教程中的方法无效,因为JSON中没有存储"标记(示例).

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/contentsrelationships.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: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"
            }
          }

请参阅文档 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆