Search code examples
autodesk-forgeautodesk-viewer

Error while trying to Display an SVF from a BIM 360 URN


I'm trying to display a revit model stored in BIM 360 using the code example from this repository: https://github.com/Autodesk-Forge/forge-tutorial-postman/blob/master/docs/display_svf.html

In this html file I only need to give my access token and the URN (encoded). This works if my model is uploaded from a bucket I had created, but I'm getting an Failed fetching Forge manifest error when I try to do it from an URN that I got from a BIM 360 document.

These are the steps I'm taking:

Getting the document URN

I used this endpoint https://developer.api.autodesk.com/data/v1/projects/b.ef7b0d22-8480-40d6-9749-12e5d7192ac9/folders/urn:adsk.wipprod:fs.folder:co.nAdJ4fwLRRuGem-qpDIlTA/contents

And from the results I get my urn:

enter image description here

Encode the URN

After that I got to https://www.base64encode.org/ and encode the value

urn:adsk.objects:os.object:wip.dm.prod/ac9e8b48-4a51-4f6a-a7e4-a947c9d6a1e6.rvt

And the result is this:

dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6d2lwLmRtLnByb2QvYWM5ZThiNDgtNGE1MS00ZjZhLWE3ZTQtYTk0N2M5ZDZhMWU2LnJ2dA

Set my access token and encoded URN in display_sfv.html

After that I place my acces token and the encoded URN, like this:

enter image description here

Finally I got this errors from the console:

enter image description here

Again this example works if I use and urn from a bucket I had created, but when I use the urn I get from a BIM 360 folder I get that error message. Where could be my mistake?


Solution

  • To load models form BIM360, you have to use the urn under derivatives attribute like below:

    "derivatives": {
            "data": {
              "type": "derivatives",
              "id": "dXJuOmFkc2sud2lwcWE6ZnMuZmlsZTp2Zi50X3hodWwwYVFkbWhhN2FBaVBuXzlnP3ZlcnNpb249MQ"
            },
            "meta": {
              "link": {
                "href": "/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcWE6ZnMuZmlsZTp2Zi50X3hodWwwYVFkbWhhN2FBaVBuXzlnP3ZlcnNpb249MQ/manifest?scopes=b360project.6f8813fe-31a7-4440-bc63-d8ca97c856b4,global,O2tenant.tenantId"
              }
            }
          },
    

    Ref: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-GET/