7 Dec 2021

Copied PDFs inside BIM360 Plans Folder

Files inside Plans Folder

Introduction

When we upload PDF files to the BIM 360 Plans folder (or any of its subfolders), we get the associated documents generated and visible through UI.

The original file is also there, available through GET Folder contents endpoint.

The way to differentiate them is through the attributes.extension.type property of the file's version.

We get the value versions:autodesk.bim360:File for original files and versions:autodesk.bim360.Document for the documents generated.

How can we retrieve both Document and File type?

To show how we can retrieve both document and file types, let's use the example below:

Example Plans Folder

Here we have one-page pdf uploaded to the Plans folder and one subfolder (Subplans).

If we call GET Folder Contents endpoint for Plans folder in this case, we'll receive the Sample Document V1 Document (with extension type versions:autodesk.bim360.Document ) and the Sample Document V1 File (with extension type versions:autodesk.bim360:File).

The Document can be obtained through export pdf from document tutorial (note that this is specific for pdf files, and you can include markups and hyperlinks), while the File can be downloaded through download files from BIM360 tutorial.

So far so good.

We also have different behavior with copied documents (thank you Allan for bringing this case to us).

We can check this difference through the example below:

What if we have copied documents?

Now let's copy the first document to Subplans folder.

copy document

If we call GET Folder contents with Subplans' urn, we'll receive only the Sample Document V1 Document (with extension type versions:autodesk.bim360.Document ). That happens because the original file isn't available under Subplans folder (it was never uploaded there).

To obtain the original file, we need to call GET Version Relationships with version id.

On the response, we'll get data.meta.extension.type: "derived:autodesk.bim360:CopyDocument", indicating that this document was copied from another one.

From there, we can check data.meta.fromId:<<ORIGINAL DOCUMENT ID>> and call GET Version Relationships with the original document id.

When we do that, we'll get data.meta.extension.type: "derived:autodesk.bim360:FileToDocument", indicating that this is the relationship between original file and its generated document.

From there, we can use fromId:<<ORIGINAL FILE ID>> to filter the items under included and find the original file.

In case you have successive copies of one document (copy from copy), you'll need to call GET Version Relationships recursively.

Document relationships

 

Related Article


Posted By

João Martins

João Martins

Joined the Developer Advocates team in 2020, João works mostly with .NET application. He is a Civil Engineer graduate with experience in software development. You can count on him to help you with your AEC related topics.