Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Model Derivative API Post Job - 400 Bad Request "Invalid 'design' parameter"

I've uploaded a Revit model to my OSS bucket and trying to translate the file to svf, but I'm getting the following:

400 Bad Request {"diagnostic":"Invalid 'design' parameter."}

I'm new to the Forge API and not sure where a design parameter is required or where it's referring to, so any guidance would be appreciated.

POST https://developer.api.autodesk.com/modelderivative/v2/designdata/job

Headers
Authorization: Bearer {AccessToken}
Content-Type: application/json

Body
{
   "input": {
     "urn": "{MyDesignBase64Urn}",
     "compressedUrn": false,
     "rootFilename": "test-project.rvt"
   },
   "output": {
     "destination": {
       "region": "us"
     },
     "formats": [
       {
         "type": "svf",
         "views": [
           "2d",
           "3d"
         ]
       }
     ]
   }
 }
like image 506
user10070674 Avatar asked Jul 12 '18 13:07

user10070674


1 Answers

For someone has met similar issue

As we per discussed, the main reason caused this issue is missing the urn: while transforming the uploaded file's objectId into base64URN.

After uploading model file on to Forge OSS bucket via PUT buckets/:bucket_key/objects/:object_name, you will obtain a response like this:

{
    "bucketKey": "mybucket",
    "objectId": "urn:adsk.objects:os.object:mybucket/rac_basic_sample_project.rvt",
    "objectKey": "rac_basic_sample_project.rvt",
    "sha1": "6d0defe9c4f8e36c7786254a3d07f9991dbf8d91",
    "size": 16474112,
    "contentType": "application/octet-stream",
    "location": "https://developer.api.autodesk.com/oss/v2/buckets/mybucket/objects/rac_basic_sample_project.rvt"
}

The URN of the uploaded model will be the objectId in above response, i.e. urn:adsk.objects:os.object:mybucket/rac_basic_sample_project.rvt. Before trigger model translation via API POST job, the objectId must have to encoded by Base64 encoder(e.g. this tool) and it becomes the below:

dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA==

But there are two invalid symbols, i.e. the two = at the end of the base64 encoded URN. You must have to remove them as below and use this URN which is a URL-safe Base64 (no padding) version to trigger a translation job of the Forge MD API.

dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA

See this official tutorial for details: https://developer.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer

like image 189
Eason Kang Avatar answered Nov 19 '22 17:11

Eason Kang