Search code examples
autodesk-forgeautodesk-model-derivative

Translate revit model to svf from bucket id


Im trying to translate a revit model to svf using this endpoint https://developer.api.autodesk.com/modelderivative/v2/designdata/job

According to the docs this endpoint needs at lest these two attributes to work:

  • urn
  • formats

First I got the objectId from the desired object inside my bucket :

"objectId":"urn:adsk.objects:os.object:gkwz1o52jxgqnqkhay5dlgcg7e2xglal_tutorial_bucket/rst_basic_sample_project.rvt"

and then I used https://www.base64encode.org/ to encode this string and get my urn, following the advice from this question how to get the urn of the bucket file. The result urn was this:

dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z2t3ejFvNTJqeGdxbnFraGF5NWRsZ2NnN2UyeGdsYWxfdHV0b3JpYWxfYnVja2V0L3JzdF9iYXNpY19zYW1wbGVfcHJvamVjdC5ydnQ=

Finally I got the format from the examples and I removed the = from the urn string.

My final body data is this:

{
    "input": {
        "urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z2t3ejFvNTJqeGdxbnFraGF5NWRsZ2NnN2UyeGdsYWxfdHV0b3JpYWxfYnVja2V0L3JzdF9iYXNpY19zYW1wbGVfcHJvamVjdC5ydnQ"
    },
    "output": {
        "formats": [
            {
                "type": "svf",
                "views": ["2d", "3d"]
            }
        ]
    }
}

But im getting this message:

enter image description here

I thought that was I getting the right object, and getting the urn, but still don't know what I'm doing wrong.


Solution

  • The endpoint URL, payload, and the base64-encoded object ID all seem to be fine. Try a couple of things:

    • Make sure that you that you're using POST method when calling the endpoint
    • Make sure that you're using the same Forge credentials (client ID and secret) you used when uploading the Revit model to the bucket
    • Try other ways of calling the endpoint, for example, using Postman or the VSCode extension