模型导数 API Post 作业 - 400 错误请求 "Invalid 'design' parameter"
Model Derivative API Post Job - 400 Bad Request "Invalid 'design' parameter"
我已将 Revit 模型上传到我的 OSS 存储桶并尝试将文件转换为 svf,但我得到以下信息:
400 错误请求 {"diagnostic":"Invalid 'design' parameter."}
我是 Forge 的新手 API,不确定哪里需要设计参数或它指的是哪里,所以任何指导将不胜感激。
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"
]
}
]
}
}
有人遇到过类似的问题
正如我们所讨论的,导致此问题的主要原因是在将上传文件的 objectId
转换为 base64URN 时缺少 urn:
。
通过PUT buckets/:bucket_key/objects/:object_name将模型文件上传到Forge OSS bucket后,您将得到如下响应:
{
"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 job, the objectId
must have to encoded by Base64 encoder(e.g. this tool) 触发模型翻译之前,它变成如下:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA==
但是有两个无效符号,即base64编码URN末尾的两个=
。您必须如下所示删除它们并使用这个 URL-safe Base64 (no padding)
版本的 URN 来触发 Forge MD API.
的翻译工作
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA
详见官方教程:https://developer.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer
我已将 Revit 模型上传到我的 OSS 存储桶并尝试将文件转换为 svf,但我得到以下信息:
400 错误请求 {"diagnostic":"Invalid 'design' parameter."}
我是 Forge 的新手 API,不确定哪里需要设计参数或它指的是哪里,所以任何指导将不胜感激。
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"
]
}
]
}
}
有人遇到过类似的问题
正如我们所讨论的,导致此问题的主要原因是在将上传文件的 objectId
转换为 base64URN 时缺少 urn:
。
通过PUT buckets/:bucket_key/objects/:object_name将模型文件上传到Forge OSS bucket后,您将得到如下响应:
{
"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 job, the objectId
must have to encoded by Base64 encoder(e.g. this tool) 触发模型翻译之前,它变成如下:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA==
但是有两个无效符号,即base64编码URN末尾的两个=
。您必须如下所示删除它们并使用这个 URL-safe Base64 (no padding)
版本的 URN 来触发 Forge MD API.
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvcmFjX2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA
详见官方教程:https://developer.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer