如何形成“GET:urn / manifest /:derivurn”请求?

时间:2018-03-16 09:16:48

标签: autodesk-forge autodesk-model-derivative

我不知道如何从Forge下载创建的衍生产品。

以下是我从“GET:urn / manifest”请求中获得的内容:

{
"type": "manifest",
"hasThumbnail": "false",
"status": "success",
"progress": "complete",
"region": "US",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA",
"version": "1.0",
"derivatives": [
    {
        "name": "Ständer_Y_Oben v1.f3d",
        "hasThumbnail": "false",
        "status": "success",
        "progress": "complete",
        "outputType": "obj",
        "children": [
            {
                "guid": "4064073b-a56c-4007-8b87-3cf87c821361",
                "type": "resource",
                "role": "obj",
                "status": "success",
                "progress": "complete",
                "mime": "application/octet-stream",
                "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/Ständer_Y_Oben v1.obj"
            }
        ]
    }
]

那么如何形成一个有效的“GET:urn / manifest /:derivurn”请求呢?文档说“urn应该是Base64(URL安全)编码设计URN”和“衍生应该是衍生的URL编码URN。”。

对我来说,这导致: https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/manifest/urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/St%C3%A4nder_Y_Oben%20v1.obj

但结果始终是“请求的衍生产品不属于设计数据”。

那有什么不对?文件还是我?

此致 迈克尔

1 个答案:

答案 0 :(得分:0)

根据GET :urn/manifest/:derivativeurn的文档,derivativeurn应该转义为网址安全表格,因为有一些保留和不安全的关键字(即:.,{此参数中包含{1}}和?)。它们将使您对Forge服务的请求无效。 (Ref

你的文件管是: =

要下载此文件,您必须将其转换为以下格式:urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/Ständer_Y_Oben v1.obj


在JavaScript中,urn%3Aadsk.viewing%3Afs.file%3AdXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA%2Foutput%2Ffiles%2F6f7db9b2-925f-44b3-92e8-a5aeeb3954d2%2FSt%C3%A4nder_Y_Oben%20v1.objRef)函数可以帮助您进行此转换。以下是您的示例:

encodeURIComponent()

如果您使用C#进行编码,encodeURIComponent('urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6ZGVyaXZhdGV0bXAvU3QlQzMlQTRuZGVyX1lfT2JlbiUyMHYxLmYzZA/output/files/6f7db9b2-925f-44b3-92e8-a5aeeb3954d2/Ständer_Y_Oben v1.obj')Ref)可以帮助您归档相同的目标。