【问题标题】:Downloading a file with the version in the name Autodesk Forge下载版本名称为 Autodesk Forge 的文件
【发布时间】:2021-12-16 20:00:10
【问题描述】:

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

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

【问题讨论】:

    标签: autodesk-forge


    【解决方案1】:

    通常我们可以在调用GET buckets/:bucketKey/objects/:objectName时在请求头Content-Disposition中找到文件名,但是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'
    

    干杯,

    【讨论】:

      猜你喜欢
      • 2021-10-24
      • 2019-10-02
      • 2019-09-19
      • 2019-05-04
      • 2019-04-25
      • 2017-12-06
      • 2019-03-14
      • 2020-02-21
      • 2016-12-15
      相关资源
      最近更新 更多