Reputation: 25
From this Api Can I get real size of composite design resource ? For instance: from Api response in "include" entity is shown the "storageSize" of selected main file during the upload of composite design :
{
"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": "[email protected]",
"lastModifiedTime": "2017-10-25T09:04:39.0000000Z",
"lastModifiedUserId": "QY23PAJ2YB4G",
"lastModifiedUserName": "[email protected]",
"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"
}
}
}
In download of the resource it will be a zip 63 MB of about size, Is there any way to get this info by Apis ? Regards Giuseppe.
Upvotes: 0
Views: 219
Reputation: 7070
I can reproduce this issue on my side. I think that might be a special case to IAM file. The file size of other ZIP files with zip extension showing on the Web UI or Forge API call is consistent with the download size as my testings. However, the actual size of the IAM file can be retrieved by API GET buckets/:bucketKey/objects/:objectName/details. Here is a cutline for interacting with the API.
For example, the storage id of the IAM file is urn:adsk.objects:os.object:wip.dm.prod/af59f346-ba31-4fd6-96a2-413606493bae.iam
otbained from the GET projects/:project_id/folders/:folder_id/contents.
So, the bucketKey will be wip.dm.prod
, the objectName will be af59f346-ba31-4fd6-96a2-413606493bae.iam
, and combination will become buckets/wip.dm.prod/objects/af59f346-ba31-4fd6-96a2-413606493bae.iam
, then the result is:
{
"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": []
}
Afterward, you will see the actual size is 66329747
bytes. It's equal to 66.3MB in my case, and consistent with the download size.
Upvotes: 1