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

1

7

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"
         ]
       }
     ]
   }
 }
Tideway answered 12/7, 2018 at 13:8 Comment(9)
What's your RVT version? Currently, Forge Model Derivative API supports only Revit 2015 and higher.Gaucho
The file is saved using Revit 2017.Tideway
I cannot get the repo from my side with the Revit 2017 sample RVT file, rac_basic_sample_project.rvt. May I ask you a favor to translate a sample RVT file of the Revit 2017 from your end?Gaucho
Here is a link to the 2017 rac_basic_sample_project.rvt that I used dropbox.com/s/l8fg2m880v2jq0r/…, and here is a link to a Postman screenshot showing the json body and 400 response dropbox.com/s/wfrgrv6sfonxl08/…Tideway
Thanks! According to your snapshot, the compressedUrn you used is true, but it should be false for RVT. Besides, there is an invalid symbol at the end of your URN, i.e. =, please check URL-safe Base64 (no padding) part in this tutorialGaucho
Before traiggering new translation, you have to set x-ads-force to true in the HTTP POST Header. Or, call API DELETE :urn/manifest to remove the failed translation.Gaucho
Did you ask the same question via [email protected]? I saw a similar case as you asked, but the requester hasn't replied yet.Gaucho
Thank you Eason! The tutorial for preparing a file for the viewer helped me understand the correct urn format (I was missing the leading "urn:"). It's working for me now. Also, yes, I asked the same question yesterday on [email protected]. Thanks again!Tideway
Glad it helps. I summarized our discussion below for others. :)Gaucho
G
10

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

Gaucho answered 14/7, 2018 at 9:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.