2

我创建了一个查看器应用程序,它使用 2-legged 身份验证并显示已上传到我自己的存储桶的项目。现在,我不想查看自己存储桶中的项目,而是希望能够查看已上传到 Autodesk A360 的项目。

为此,我完成了以下步骤:

因此,转换后的 URN 应与 A360 用于其自己的查看器的相同。

在我自己的应用程序上使用 URN 查看项目时,网络控制台显示以下错误消息: 错误信息

查看具体请求时,返回以下响应: 回复

我还确保转换后的 URN 等于 A360 正在使用的 URN。为此,我将其与 A360 的响应进行了比较: 瓮

所以由于查看器在A360中工作,我想知道A360中的项目是否也可以在我自己的应用程序中查看(A360查看器已经存在存储桶,因此没有理由重复创建存储桶的相同过程和上传文件)。如果可以使用与URN相同的项目,那么我也想知道为什么请求是未经授权的。

如果您需要任何其他代码,请务必询问。

4

3 回答 3

1

您可以在 GiHub 上查看以下三个示例,这三个示例都可以访问 A360 上的 CAD 模型并在查看器中显示它们:

数据管理 APIP 示例:https ://github.com/Developer-Autodesk/data.management.api-nodejs-sample

模型衍生 API 示例:https ://github.com/Developer-Autodesk/model.derivative.api-nodejs-sample

实时往返BIM编辑器:https ://github.com/jeremytammik/model.derivative.api-nodejs-sample-roomedit3d

其工作证明由 roomedit3dv2 往返 Forge BIM edi 提供,8 分钟演示记录:

https://www.youtube.com/watch?v=bDI5YX7PDP8

祝你好运!

于 2016-06-15T13:03:15.513 回答
1

After comparing my solution against Augusto Goncalves' application at https://github.com/Developer-Autodesk/data.management.api-nodejs-sample, I finally managed to solve the problem.

  • Instead of downloading the project and uploading it to my own bucket, as described in https://developer.autodesk.com/en/docs/data/v2/tutorials/app-managed-bucket/, gotten the identificator (urn:adsk.wipprod:fs.file:vf.6bVr4EVDSaOpykczeQYR2Q?version=1) from the result of the file request and converted it to an URL-friendly Base64 (dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bXktYnVja2V0L215LWF3ZXNvbWUtZm9yZ2UtZmlsZS5ydnQ=).

Although this method returns a correct URN, then in addition to URN an acmsession must be also added to the request. From the sample code above, I managed to reverse-engineer the following request:

curl -X 'POST' \
 -H "Authorization: Bearer $token" -H 'Content-Type: application/json' \
 -v 'https://developer.api.autodesk.com/oss-ext/v1/acmsessions' -d \
 '{
    "application": "autodesk",
    "x-ads-acm-check-groups": "true",
    "x-ads-acm-namespace": "WIPDM"
  }'

The result of this request returns a code, which must be added to the URN. Instead of adding it to the end of request URL, it should be added to the method that is being called:

viewer.load(doc.getViewablePath(geometryItems[0]), null, null, null, doc.acmSessionId /*session for DM*/);

Using this solution required changes to be made to the instantiation of the viewer. Instead of doing it like described in https://developer.autodesk.com/en/docs/viewer/v2/tutorials/basic-viewer/, I changed it to the solution that is in index.js file of the sample code above.

于 2016-06-17T08:19:31.063 回答
1

我已经得到开发团队的确认,您不应该使用 ACM 标头或依赖 WIPDM urn 来直接加载您的可视文件。这将在未来的某个时候停止工作。我们将直接在衍生服务中添加一些逻辑来抽象它并允许您这样做。

目前不幸的是,更喜欢使用 A360 项目版本中的存储 URN 并发布自定义 svf 作业,该作业将生成一组您可以依赖的新可视项。

您可以在我的forge 示例中看到一个具体示例

//pick the last version by default
var version = item.versions[ item.versions.length - 1 ]

var storageUrn = window.btoa(
    version.relationships.storage.data.id)

// !IMPORTANT: remove all padding '=' chars
// not accepted by the adsk services

storageUrn = storageUrn.replace(new RegExp('=', 'g'), '')

var urn = version.relationships.derivatives.data.id

console.log('A360 URN: ' + urn)  // -> just for info
console.log('Storage URN: ' + storageUrn) // -> use this URN to POST svf and trigger translation
于 2016-07-12T11:51:28.537 回答