Devin
Devin

Reputation: 505

Are there 'item' types that don't have an associated storageSize attribute?

I'm trying to associate a storageSize with each item in a folder with the following code:

foldersApi.getFolderContents(projectId, folderId, {}, oAuth2ThreeLegged, credentials)
  .then((response) => {
    const data = response.body.data;
    const included = response.body.included;

    const filesArray = data.filter(thing => thing.type === 'items');
    filesArray.forEach(file => {
      const version = included.find((i) => i.type === 'versions' && i.relationships.item.data.id === file.id);
      file.storageSize = version.attributes.storageSize;
    });
  })

In the Data Management API Fieldguide, it states that a Version object will only have the storageSize attribute if the item is a file. What type of item would not be a file?

Is it possible for a file to be missing this attribute?

If it's relevant, the folder is within a BIM 360 account.

Upvotes: 0

Views: 85

Answers (1)

Zhong Wu
Zhong Wu

Reputation: 2024

Within a BIM360 project folder, there would be data types including "folders" and "items".

Yes, there are some cases that the file version miss the "storageSize" property, here are some cases we are already aware:

  1. There used to have an issue that files uploaded from BIM360 Docs UI missing this property, details please check "storageSize" deosn't appear in versions endpoint response of uploaded file , this issue is already logged and investigated, and it should be fixed according to my verification just now, we can get the "storageSize" property even the file is uploaded from UI, please verify and I am also confirming with our engineer now(will update you soon). But for the legacy files which are already uploaded from UI, unfortunately, the property is still missing.

  2. For some files which are not a normal "Seed" file, for example, it's a document that is extracted from the seed file(model), it's designed not have that property, but let me know if you have good reason to request that property even for extracted document.

  3. If the file is already marked deleted, and if you search the all the files including hidden by includeHidden=true, you will see that the file version also doesn't have "storageSize" property, which is as designed.

If you indeed want to get the storage size but it's not listed in version property, the workaround is to get the size from OSS, that's another story, we can talk that if that's your requirement.

If you see other situation that the property is missing, please raise it to us.

Upvotes: 1

Related Questions