首页 > 解决方案 > 下载版本名称为 Autodesk Forge 的文件

问题描述

我正在使用 CURL 从 BIM360 文档管理中下载文件,工作正常,我也可以为文件命名。

但我们也要求它下载文件并自动将版本名称添加到文件中。CURL 和 Forge 有可能发生这样的事情吗?

标签: autodesk-forge

解决方案


通常,我们可以Content-Disposition在调用GET buckets/:bucketKey/objects/:objectName时在请求头中找到文件名,但 BIM360 对象略有不同。文件名存储在版本提示中。

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization, Accept-Encoding, Range, Content-Type
Access-Control-Allow-Methods: GET
Access-Control-Allow-Origin: *
Content-Disposition: attachment; filename="test.txt"
Content-Type: application/x-www-form-urlencoded
Date: Sat, 21 May 2016 00:24:25 GMT
ETag: "33a16388013ce310564af70b0ef5320d8fd85444"
Server: Apigee Router
Content-Length: 618
Connection: keep-alive

因此,您需要先从版本的显示名称中获取文件名,然后使用从版本提示中获得的显示名称调用GET buckets/:bucketKey/objects/:objectName 。

使用 curl,我们可以通过添加 -o 选项来命名,请参阅https://stackoverflow.com/a/69520470/7745569

curl -o rst_house.rvt --location --request GET 'https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/a755b110-3d32-567b-871c-cb555e6087c1.rvt' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/octet-stream'

干杯,


推荐阅读