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

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

问题描述

我正在尝试从Autodesk BIM360 Doc( https://docs.b360.autodesk.com ),然后再将文件归档到我们的本地存储中.

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 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.

推荐答案

计划"文件夹中列出的项目是 items:autodesk.bim360:Document 的类型,该类型的项目将没有直接获取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.

要获取物理文件位置,应致电使用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

更新复制的项目

在通过

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.

在这种情况下,它是 {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.

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

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