API 从 BIM360 Doc Plans 文件夹下载文件 [英] API Download File from BIM360 Doc Plans folder

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

问题描述

我正在尝试从 Autodesk BIM360 Doc (https://docs.b360.autodesk.com) 与 Forge API 一起使用,以便之后可以将文件存档到我们的本地存储中.

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.

我已设法使用数据管理 API 文件夹下载任何文件/reference/http/projects-project_id-versions-version_id-GET/" rel="nofollow noreferrer">https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-GET/,我可以通过它获取data.relationships.storage.data.id下的存储ID.

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.

但是使用相同的 API 时,我无法在 计划" 文件夹下查询文件时获取存储 ID,

however with the same API i cannot get the storage Id when querying files under "Plan" folder,

那么我们可以通过 Forge API 从 Plan 文件夹下载文件吗?任何帮助表示赞赏.

So is there any way with Forge API we can download a file from Plan folder? any help is appreciated.

推荐答案

Plan 文件夹中列出的项目属于 items:autodesk.bim360:Document 类型,该类型项目不会有GET 版本/:version_id直接获取 items/:item_id.

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.

要获取物理文件位置,您应该调用 GET versions/:version_id/relationships/refs 代替,请参阅此处了解类似的主题:使用 Autodesk API 下载文档

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

复制项目的更新

通过GET versions/:version_id/relationships/refs,你会看到一个数据属性,根据我的经验告诉复制的项目和源项目之间的关系:

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": {}
            }
        }
    }
],  

之后,您必须通过调用GET 版本/:version_id/relationships/refs.

Afterward, you have to access the version relationship dat of the fromId via calling GET versions/:version_id/relationships/refs.

在本例中,它是 {PROJ_ID}/versions/urn:adsk.wipprod:fs.file:vf.34Xvlw1jTcSQ_XkIVh07cg%3Fversion=2/relationships/refs,然后您将看到 storage 属性在我调查的响应中.

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.

这篇关于API 从 BIM360 Doc Plans 文件夹下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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