未经授权从 BIM 360 下载文件

Download Files from BIM 360 Without Authorization

我正在 Autodesk Forge 中集成设计自动化和 BIM 360 API

  1. 我调用步骤 7 设计自动化 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"
          }
        }
      }'

参数rvtFile.(url), i binding link Bim 360 Document中第5步下载的文件 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"
        }
    }
}

但是当通过API Bim 360 下载文件 revit 时失败,因为需要令牌授权 那么有没有办法不用token就可以从bim 360下载文件呢?

不幸的是,如果不传递访问令牌,您将无法调用 OSS API https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/11d42fe8-7612-4120-ad7d-a688e49143a1.rvt

解决方案是使用 Signed URL 下载文件,但由于您不是存储桶 wip.dm.prod 的所有者。它归 BIM360 或 ACC 服务本身所有。因此,您无法为存储在 wip.dm.prod 存储桶中的对象创建 Signed URL。所以,此时,请传递一个有效的访问令牌,如下所示:

{
    "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"
        }
    }
}