VU Nguyen Trong VTID9
VU Nguyen Trong VTID9

Reputation: 25

Download Files from BIM 360 Without Authorization

I am integrating between Design automation and BIM 360 API in autodesk forge

  1. I call step 7 Design automation https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step7-post-workitem/
{
        "activityId": "YOUR_NICKNAME.DeleteWallsActivity+test",
        "arguments": {
          "rvtFile": {
            "url": "SIGNED_URL_TO_INPUT_FILE",
            "pathInZip": "PATH_TO_RVT_FILE_WITHIN_ZIP_FILE"
          },
          "result": {
            "verb": "put",
            "url": "SIGNED_URL_TO_RESULT"
          }
        }
      }'

The param rvtFile.(url), i binding link download file by step 5 in Bim 360 Document https://forge.autodesk.com/en/docs/bim360/v1/tutorials/document-management/download-document/

{
    "activityId": "cbbdemo.DemoTestingActivity43+test",
    "arguments": {
        "rvtFile": {
            "url": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/11d42fe8-7612-4120-ad7d-a688e49143a1.rvt",
            "localName": "testing.rvt",
        },
        "params": {
            "url": "data:application/json,{'action' : 'generate','scaffoldName' : 'SM0918', 'space' : 300,'isGenFront' : true,'data' : ['138763','138533']}"
        },
        "result": {
            "verb": "put",                            
            "url": "https://developer.api.autodesk.com/oss/v2/signedresources/fbe64c4f-1073-49a7-810b-95658e51b361?region=US"
        }
    }
}

But when download file revit by API Bim 360 is failed because need token Authorization So is there a way to download files from bim 360 without tokens?

Upvotes: 1

Views: 498

Answers (1)

Eason Kang
Eason Kang

Reputation: 7070

Unfortunately, you cannot call the OSS API https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/11d42fe8-7612-4120-ad7d-a688e49143a1.rvt without passing an access token.

The solution is to use a Signed URL to download the file, but since you're not the owner of the bucket wip.dm.prod. It's owned by BIM360 or ACC service itself. So you cannot create Signed URLs for objects stored on the wip.dm.prod bucket. So, at this moment, please pass a valid access token like the one below:

{
    "activityId": "cbbdemo.DemoTestingActivity43+test",
    "arguments": {
        "rvtFile": {
            "url": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/11d42fe8-7612-4120-ad7d-a688e49143a1.rvt",
            "localName": "testing.rvt",
            "headers": {
                "Authorization": "Bearer {{Bearer}}",
                "Content-Type": "application/octet-stream"  
            }
        },
        "params": {
            "url": "data:application/json,{'action' : 'generate','scaffoldName' : 'SM0918', 'space' : 300,'isGenFront' : true,'data' : ['138763','138533']}"
        },
        "result": {
            "verb": "put",                            
            "url": "https://developer.api.autodesk.com/oss/v2/signedresources/fbe64c4f-1073-49a7-810b-95658e51b361?region=US"
        }
    }
}

Upvotes: 2

Related Questions