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

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

问题描述

我已将 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"
         ]
       }
     ]
   }
 }

推荐答案

对于有人遇到过类似问题

正如我们所讨论的,导致此问题的主要原因是在将上传文件的 objectId 转换为 base64URN 时丢失了 urn:.

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

通过PUT buckets/: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 jobobjectId 必须由 Base64 编码器编码(例如 这个工具) 变成下面这样:

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-safe 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/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer

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

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