0

从这个Api我可以得到复合设计资源的真实大小吗?例如:在“include”实体中的 Api 响应显示在复合设计上传期间所选主文件的“storageSize”:

{
        "type": "versions",
        "id": "urn:adsk.wipprod:fs.file:vf.wuknEcO8TjiWoHMfXUwuPQ?version=1",
        "attributes": {
            "name": "V8 Engine.iam",
            "displayName": "V8 Engine.iam",
            "createTime": "2017-10-25T09:04:39.0000000Z",
            "createUserId": "QY23PAJ2YB4G",
            "createUserName": "bot@autodesk360.com",
            "lastModifiedTime": "2017-10-25T09:04:39.0000000Z",
            "lastModifiedUserId": "QY23PAJ2YB4G",
            "lastModifiedUserName": "bot@autodesk360.com",
            "versionNumber": 1,
            "mimeType": "application/vnd.autodesk.inventor.assembly",
            "storageSize": 7998976,
            "fileType": "iam",
            "extension": {
                "type": "versions:autodesk.a360:CompositeDesign",
                "version": "1.0",
                "schema": {
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.a360:CompositeDesign-1.0"
                },
                "data": {
                    "parentFile": "V8 Engine/V8 Engine.iam"
                }
            }
        }

在下载资源时,它将是一个大小约为 63 MB 的 zip,有什么方法可以通过 Apis 获取此信息?问候朱塞佩。

4

1 回答 1

1

我可以在我这边重现这个问题。我认为这可能是 IAM 文件的特例。Web UI 或 Forge API 调用上显示的其他带有 zip 扩展名的 ZIP 文件的文件大小与我测试时的下载大小一致。但是,可以通过 API GET buckets/:bucketKey/objects/:objectName/details检索 IAM 文件的实际大小。这是与 API 交互的切线。

例如,IAM 文件的存储 id 是urn:adsk.objects:os.object:wip.dm.prod/af59f346-ba31-4fd6-96a2-413606493bae.iamGET projects/:project_id/folders/:folder_id/contents中获取的。

因此,bucketKey 为wip.dm.prod, objectName 为af59f346-ba31-4fd6-96a2-413606493bae.iam,组合为buckets/wip.dm.prod/objects/af59f346-ba31-4fd6-96a2-413606493bae.iam,则结果为:

{
    "bucketKey": "wip.dm.prod",
    "objectId": "urn:adsk.objects:os.object:wip.dm.prod/af59f346-ba31-4fd6-96a2-413606493bae.iam",
    "objectKey": "af59f346-ba31-4fd6-96a2-413606493bae.iam",
    "sha1": "12504df0c2dbcf52501ae7371781241f8a8d4f36",
    "size": 66329747,
    "contentType": "application/octet-stream",
    "location": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/af59f346-ba31-4fd6-96a2-413606493bae.iam",
    "blockSizes": [
        2048
    ],
    "deltas": []
}

之后,您将看到实际大小是66329747字节。在我的情况下它等于 66.3MB,并且与下载大小一致。

于 2018-05-25T03:15:22.670 回答