如何检查存储桶对象是否已翻译

how to check if bucket object is already translated

我已经上传文件到oss并且有object id,如果bucket object还没有翻译那么如何查看衍生信息。使用对象 ID?

很简单,只需对您的 objectId 进行 base64 编码,然后调用 GET {urn}/manifest。如果它 returns 一个 404 http 状态代码,则意味着这个 URN 还没有被翻译。

如果您的文件存储在 BIM360/ACC,您将需要从文件的版本提示中获取派生 URN。请按照本教程进行操作,但要查找 relationships.data.derivatives.data.id 而不是 URN,例如如下所示。

https://forge.autodesk.com/en/docs/bim360/v1/tutorials/document-management/download-document/#step-4-find-the-storage-object-id-for-the-file

"derivatives": {
    "data": {
        "type": "derivatives",
        "id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLkVueWtrU3FjU0lPVTVYMGhRdy1mQUM_dmVyc2lvbj0x"
    },
    // ...
},

Node.js 使用 yiskang/forge-viewmodels-nodejs-svf2

测试的代码示例
const {
    DerivativesApi
} = require('forge-apis');

const { getClient, getPublicToken } = require('./routes/common/oauth');

const derivativeApi = new DerivativesApi();

const urn = 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXlidWNrZXQvdGVzdC5ydnQ';

getPublicToken().then(accessToken => {
    derivativeApi.getManifest(urn, {}, null, accessToken).then(function (res) {
        console.log(res.statusCode, res.statusMessage);
    },
    function (err) {
        // When the urn hasn't got translated, it goes here
        console.error('error', err.statusCode, err.statusMessage);
        // if you want to redire page to some where, write your codes here
    });
}, function (err) {
    console.error(err);
});

参考: