Community
BIM 360 API Forum
Welcome to Autodesk’s BIM 360 API Forums. Share your knowledge, ask questions, and explore popular BIM 360 API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Publishing Revisions

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
JarredJackson
1051 Views, 4 Replies

Publishing Revisions

JarredJackson
Contributor
Contributor

When you publish a revision of a document using the API, is it necessary to change the filename? When I leave the name the same, a new revision is not created despite including the document id in the request so that the file can be replaced. The JSON file returns a revision count that is the same as the previous version and a revision position of 0. I am having to change the filename to be saved in BIM 360  as well as including the document id in the POST request. This is different to uploading from within BIM 360 where the filename needs to be the same for a revision to be created. Is this working correctly for me?

0 Likes

Publishing Revisions

When you publish a revision of a document using the API, is it necessary to change the filename? When I leave the name the same, a new revision is not created despite including the document id in the request so that the file can be replaced. The JSON file returns a revision count that is the same as the previous version and a revision position of 0. I am having to change the filename to be saved in BIM 360  as well as including the document id in the POST request. This is different to uploading from within BIM 360 where the filename needs to be the same for a revision to be created. Is this working correctly for me?

4 REPLIES 4
Message 2 of 5

xiaodong_liang
Autodesk Support
Autodesk Support

Hi @JarredJackson,

 

Could you clarify if this is a question on BIM 360 Docs API (Forge), or BIM 360 Glue API (legacy API) ?

 

regarding with  BIM 360 Docs API (Forge), different version corresponds to different physical file. So you will need to create a cloud storage and upload the new file, then call update a new version to associate the virtual item (v1, v2 ,v3...) with the  physical file.

 

my colleague has produced a nice blog on the detail. Could you take a look if it helps?

https://forge.autodesk.com/blog/update-bim360-docs-file-version-insomnia-rest-and-data-management-ap...

 

0 Likes

Hi @JarredJackson,

 

Could you clarify if this is a question on BIM 360 Docs API (Forge), or BIM 360 Glue API (legacy API) ?

 

regarding with  BIM 360 Docs API (Forge), different version corresponds to different physical file. So you will need to create a cloud storage and upload the new file, then call update a new version to associate the virtual item (v1, v2 ,v3...) with the  physical file.

 

my colleague has produced a nice blog on the detail. Could you take a look if it helps?

https://forge.autodesk.com/blog/update-bim360-docs-file-version-insomnia-rest-and-data-management-ap...

 

Message 3 of 5

xiaodong_liang
Autodesk Support
Autodesk Support

Hi @JarredJackson,

 

I should point out this tutorial which has more detailed steps. Hope it helps.

0 Likes

Hi @JarredJackson,

 

I should point out this tutorial which has more detailed steps. Hope it helps.

Message 4 of 5

JarredJackson
Contributor
Contributor

Hi @xiaodong_liang,

 

My question was in relation to the BIM 360 Field - API Doc (Field Classic). Using the library in BIM 360 Field Classic, a revision is added to a document when it is uploaded with the same name as an existing document. Using the POST /api/library/publish function of the API, I am having to change the filename before a revision is created, despite the document_id being included in the request.

0 Likes

Hi @xiaodong_liang,

 

My question was in relation to the BIM 360 Field - API Doc (Field Classic). Using the library in BIM 360 Field Classic, a revision is added to a document when it is uploaded with the same name as an existing document. Using the POST /api/library/publish function of the API, I am having to change the filename before a revision is created, despite the document_id being included in the request.

Message 5 of 5

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi @JarredJackson,

 

I took time to test the workflow with my project. The API is working well. The following is the code snippet of publishing new version. I do not even need to specify the document_id. I just ensured the file name is same. 

 

The only behavior I observed: if the new version file is same to the last version, the 'new version' will not be generated in Field, though Publish succeeded. This is same to UI and makes sense to me. maybe what you encountered is because you published a same file (same file name and same MD5/SHA1) ?

 

Could you check if my code snippet that could help you diagnose the problem? if you still have the issue, please isolate and send us a small test sample. 

 

 void field_publishDoc()
  {
            var client = new RestClient("https://bim360field.autodesk.com");
            var request = new RestRequest(Method.POST);
            request.Resource = "api/library/publish?replace=0";
            request.AddParameter("ticket", thisticket);
            request.AddParameter("project_id", pjoId);
            request.AddParameter("directory", "Equipment");
            //request.AddParameter("document_id", "zzzz-zzz-zzz-zzzz-zzzzzzz");  
            request.AddParameter("filename", System.IO.Path.GetFileName("xiaodongtest.pdf"));
            request.AddFile("Filedata", @"c:\temp\xiaodongtest.pdf");

            var response = client.Execute(request);

            if(response.StatusCode == HttpStatusCode.Created)
            {
                byte[] file_bytes = response.RawBytes;
            }
            else
            {
                System.Diagnostics.Debug.Write("publish failed: " + response.StatusDescription);

            }

   }

 

0 Likes

Hi @JarredJackson,

 

I took time to test the workflow with my project. The API is working well. The following is the code snippet of publishing new version. I do not even need to specify the document_id. I just ensured the file name is same. 

 

The only behavior I observed: if the new version file is same to the last version, the 'new version' will not be generated in Field, though Publish succeeded. This is same to UI and makes sense to me. maybe what you encountered is because you published a same file (same file name and same MD5/SHA1) ?

 

Could you check if my code snippet that could help you diagnose the problem? if you still have the issue, please isolate and send us a small test sample. 

 

 void field_publishDoc()
  {
            var client = new RestClient("https://bim360field.autodesk.com");
            var request = new RestRequest(Method.POST);
            request.Resource = "api/library/publish?replace=0";
            request.AddParameter("ticket", thisticket);
            request.AddParameter("project_id", pjoId);
            request.AddParameter("directory", "Equipment");
            //request.AddParameter("document_id", "zzzz-zzz-zzz-zzzz-zzzzzzz");  
            request.AddParameter("filename", System.IO.Path.GetFileName("xiaodongtest.pdf"));
            request.AddFile("Filedata", @"c:\temp\xiaodongtest.pdf");

            var response = client.Execute(request);

            if(response.StatusCode == HttpStatusCode.Created)
            {
                byte[] file_bytes = response.RawBytes;
            }
            else
            {
                System.Diagnostics.Debug.Write("publish failed: " + response.StatusDescription);

            }

   }

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report