模型衍生 API 发布作业

编程入门 行业动态 更新时间:2024-10-09 15:25:13
本文介绍了模型衍生 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 developer.api.autodesk/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": "developer.api.autodesk/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,objectId 必须由 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

详见官方教程:developer.autodesk/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer

更多推荐

模型衍生 API 发布作业

本文发布于:2023-10-10 17:56:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479321.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   模型   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!