模型衍生API发布作业-400错误的请求“无效的'design'参数” [英] Model Derivative API Post Job - 400 Bad Request "Invalid 'design' parameter"

查看:129
本文介绍了模型衍生API发布作业-400错误的请求“无效的'design'参数”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Revit模型上传到OSS存储桶,并尝试将文件转换为svf,但是我得到以下信息:

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错误请求{ diagnostic:无效的'design'参数。}

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

我是Forge API的新手,不确定是否需要设计参数或在何处引用设计参数,因此任何指导都将不胜感激。

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"
         ]
       }
     ]
   }
 }


推荐答案

对于某人遇到了类似的问题

正如我们所讨论的,导致此问题的主要原因是缺少 urn:,同时将上传文件的 objectId 转换为base64URN。

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

通过将模型文件上传到Forge OSS存储桶后href = https://developer.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-PUT rel = nofollow noreferrer> PUT桶/:bucket_key / objects /:object_name ,您将获得如下响应:

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"
}

上载模型的URN将为上述响应中的 objectId ,即 urn:adsk.objects:os.object:mybucket / rac_basic_sample_project。 rvt 。通过API触发模型转换之前 POST作业,必须使用Base64编码器对 objectId 进行编码(例如,此工具),它就会变成以下内容:

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==

但是有两个无效符号,即两个 = base64编码的URN的末尾。您必须按照以下说明删除它们,并使用此URN( URL安全的Base64(无填充)版本)来触发Forge MD API的翻译工作。

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

有关详细信息,请参见此官方教程: https://developer.autodesk.com/zh-CN/docs/model-derivative/v2/tutorials/prepare-file-for-viewer

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

这篇关于模型衍生API发布作业-400错误的请求“无效的'design'参数”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆