有没有办法从物品ID获取物品URN?

huangapple go评论54阅读模式
英文:

Is there a way to obtain an item URN from item ID?

问题

我目前正在使用BIM 360 API通过数据连接端点提取提交数据,用于项目结束后的本地存档(因为API中仍然没有提交端点)。其他相关的提交方面都比较容易,但在获取相关附件时遇到了问题。"submittals_attachments.csv" 只包含附件的GUID,而不包含用于获取S3URL以下载的URN。是否有一个接受非URN格式ID并返回包含正确URN的元数据的端点?

或者,更好的是,是否有一个资源可以解释如何生成URN以用于构建URN?到目前为止,我已经看到不同的URN格式,每个部分的确切含义都不清楚(例如,"urn:adsk.objects:os.object:wip.dm.prod/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf"与"urn:adsk.wipprod:dm.lineage:6bVr4EVDSaOpykczeQYR2Q"和"urn:adsk.wipprod:fs.folder:co.uvDiLQ5DRYidDQ_EFW1OOg")。我认为每个附件都应该有一个正确的URN,而不管是否通过API公开,因为当您单击网站UI的下载按钮时,文件很容易传递到S3URL端点。如果有一种可预测的方法来构建URN,那么也许可以像正常一样将其传递给下载端点。

GET https://developer.api.autodesk.com/data/v1/projects/[PROJECTID]/items/ad0fdf7e-dbe8-437d-afcc-1ba72c6b842b

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "ad0fdf7e-dbe8-437d-afcc-1ba72c6b842b",
            "status": "400",
            "code": "BAD_INPUT",
            "title": "One or more input values in the request were bad",
            "detail": "The provided urn is invalid."
        }
    ]
}

已知附件的URN通过问题和RFI端点获得,因此看起来这似乎是一个项目ID格式的问题。

英文:

I am currently using Data Connector endpoints via the BIM 360 API to pull submittal data for on-prem archival post-project close (since there still aren't Submittal endpoints in the API). The other related submittal aspects have been easy enough, but I've hit a roadblock with fetching the associated attachments. The submittals_attachments.csv only contains the guid for the attachment, not the URN that can be used to obtain the S3URL for download. Is there an endpoint that accepts non-URN formatted IDs for items and returns metadata that contains a proper urn?

Or, better yet, is there a resource that explains how the URN is generated that can be used to construct the urn? I've seen different URN formats so far and it isn't clear exactly what each part means (E.g. urn:adsk.objects:os.object:wip.dm.prod/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf vs urn:adsk.wipprod:dm.lineage:6bVr4EVDSaOpykczeQYR2Q vs urn:adsk.wipprod:fs.folder:co.uvDiLQ5DRYidDQ_EFW1OOg.) I would think each attachment has a proper URN regardless of exposure via the API, being that the files are easily passed to the S3URL endpoints when you click the site UI's download button. If there's a predictable way to build the URN then perhaps that can be passed to the download endpoints like normal.

GET https://developer.api.autodesk.com/data/v1/projects/[PROJECTID]/items/ad0fdf7e-dbe8-437d-afcc-1ba72c6b842b

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "ad0fdf7e-dbe8-437d-afcc-1ba72c6b842b",
            "status": "400",
            "code": "BAD_INPUT",
            "title": "One or more input values in the request were bad",
            "detail": "The provided urn is invalid."
        }
    ]
}

Works with known urns of attachments obtained via Issues and RFI endpoints so it appears to be an itemId format issue.

答案1

得分: 0

更新

在与我们的工程团队讨论后,这个问题现在应该已经修复了。你应该能够在提取的submittals_attachments.csv中看到BIM360提交附件的upload_urn,如下所示:

有没有办法从物品ID获取物品URN?

============================

首先,澄清一下。不幸的是,OSS对象ID和项目URN之间没有等号(saying urn:adsk.objects:os.object:wip.dm.prod/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf vs urn:adsk.wipprod:dm.lineage:6bVr4EVDSaOpykczeQYR2Q)。

现在回到问题:

你的ad0fdf7e-dbe8-437d-afcc-1ba72c6b842b是什么?

一旦我们已经有了从数据管理中下载文件的对象ID(saying urn:adsk.objects:os.object:wip.dm.prod/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf),那么你不需要调用GET items API。请按照获取S3 URL的教程步骤来下载附件。

示例API调用

// 使用3-legged访问令牌调用此端点

curl -X GET -H "Authorization: Bearer nFRJxzCD8OOUr7hzBwbr06D76zAT..." "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf/signeds3download"

示例响应

// 使用响应中获取的URL下载文件。
{
    "status": "complete",
    "url": "https://cdn.us.oss.api.autodesk.com/....",
    "params": {
        "content-type": "application/octet-stream",
        "content-disposition": "attachment; filename=\"xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf\""
    },
    "size": 344843,
    "sha1": "a039f6b8....af76bb"
}
英文:

Updates

After discussing this with our engineering team, this issue should be fixed now. You should be able to see upload_urn for BIM360 Submittals Attachments in the extracted submittals_attachments.csv like below:

有没有办法从物品ID获取物品URN?

============================

First, just to clarify. There is no equality between OSS Object id and item URN, unfortunately. (saying urn:adsk.objects:os.object:wip.dm.prod/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf vs urn:adsk.wipprod:dm.lineage:6bVr4EVDSaOpykczeQYR2Q )

And then now going back to the question:

What is your ad0fdf7e-dbe8-437d-afcc-1ba72c6b842b?

Once we have the object id already for downloading the file from Data Management (saying urn:adsk.objects:os.object:wip.dm.prod/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf), so you don't need to call the GET items API. Please follow this step Get the S3 URL of the tutorial to download the attachment.

Example API call

// Call this endpoint with the 3-legged access token

curl -X GET -H "Authorization: Bearer nFRJxzCD8OOUr7hzBwbr06D76zAT..." "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf/signeds3download"

Example Response

// Download the file with the URL you get from the response.
{
    "status": "complete",
    "url": "https://cdn.us.oss.api.autodesk.com/....",
    "params": {
        "content-type": "application/octet-stream",
        "content-disposition": "attachment; filename=\"xxxxxxxx-40q5-4eb9-a4a3-xxxxxxxxxxxx.pdf\""
    },
    "size": 344843,
    "sha1": "a039f6b8....af76bb"
}

huangapple
  • 本文由 发表于 2023年3月31日 22:45:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75899860.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定