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"
         ]
       }
     ]
   }
 }
  • What's your RVT version? Currently, Forge Model Derivative API supports only Revit 2015 and higher. – Eason Kang Jul 12 '18 at 13:38
  • The file is saved using Revit 2017. – user10070674 Jul 12 '18 at 14:10
  • 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? – Eason Kang Jul 12 '18 at 15:13
  • Here is a link to the 2017 rac_basic_sample_project.rvt that I used https://www.dropbox.com/s/l8fg2m880v2jq0r/rac_basic_sample_project_2017.rvt?dl=0, and here is a link to a Postman screenshot showing the json body and 400 response https://www.dropbox.com/s/wfrgrv6sfonxl08/ForgePostJobInvalidDesignParameter.png?dl=0 – user10070674 Jul 12 '18 at 16:54
  • 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 [tutorial](https://developer.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer/) – Eason Kang Jul 12 '18 at 17:00
  • Before traiggering new translation, you have to set `x-ads-force` to `true` in the HTTP POST Header. Or, call API [DELETE :urn/manifest](https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-manifest-DELETE/) to remove the failed translation. – Eason Kang Jul 12 '18 at 17:03
  • Did you ask the same question via `forge.help@autodesk.com`? I saw a similar case as you asked, but the requester hasn't replied yet. – Eason Kang Jul 12 '18 at 17:05
  • 1
    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 forge.help@autodesk.com. Thanks again! – user10070674 Jul 12 '18 at 17:24
  • Glad it helps. I summarized our discussion below for others. :) – Eason Kang Jul 14 '18 at 09:15

1 Answers1

9

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

Eason Kang
  • 6,155
  • 1
  • 7
  • 24