2

I'm using CURL to download a file from BIM360 document management, works fine, and I can give the file a name as well.

But we also require it to download the file and automatically add the version name to the file. Is something like this possible to do with CURL and Forge?

1 Answers1

0

Commonly, we can find the filename in the request header Content-Disposition when calling GET buckets/:bucketKey/objects/:objectName, but BIM360 objects are a little different. The filename is stored in the version tip.

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

Therefore, you need to get the filename from the display name of the version first, then call GET buckets/:bucketKey/objects/:objectName with the display name you got from its version tip.

With curl, we can give the name by adding the -o option, see 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'

Cheers,

Eason Kang
  • 6,155
  • 1
  • 7
  • 24