Community
Upchain Forum
Welcome to the Upchain Forum. Share your knowledge, ask questions, and explore popular Upchain topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API: Downloading Assemblies of Parts

2 REPLIES 2
Reply
Message 1 of 3
imckenzieY7CGY
200 Views, 2 Replies

API: Downloading Assemblies of Parts

There was some discussion here, which I think is related to my question: https://forums.autodesk.com/t5/upchain-forum/upchain-restful-api-acquiring-the-fileversionid/m-p/120...

 

But that seems to be looking at downloading a single part. I'm would like to clarify how one would go about downloading a full assembly of parts (specifically .SLDASM and .SLDPRT files) through the API. I think I see a couple of potential strategies: 

  1. Get a cBOM for a parent assembly and recursively download all of the parts in the cBOM:
    1. '/api/bom/v1/part_version/{partVersionId}/cbom' appears to be the endpoint for getting the cBOM of an item. There's also '.../cbom_tree' - not sure if that's related. 
    2. Recursively go through the cBOM and do what Sven had suggested in the post linked above.
  2. There appears to be a 'download' endpoint that will generate a download URL:
    1. '/api/bom/v1/cbom/download' is supposed to return a url pointing to a zip to be downloaded. 
    2. Could download and extract zip instead of downloading files one-by-one? 
    3. Looks like the request body requires an array to say which files need to be zipped, not just a "zip all files under this parent" kind of thing? So you'd have to flatten the cBOM into a set of unique files I guess. 

 

Are either of these the most correct way to do this? Are there any nuances I'm missing?

 

Thanks

Labels (1)
  • API
2 REPLIES 2
Message 2 of 3

So far I've found that /api/bom/v2/cbom_tree seems to actually be the most appropriate for getting the files to download. However, I'm running into an issue where I can't download some files, and I think it's correlated with /api/bom/v1/file_version/{fileVersionId}/info coming back with 

InaccessibleOwnershipServer = true. However, I know for a fact that I can download these files in the plugin, so I'm wondering how I get around the issue of /api/bom/v1/file_version/{fileVersionId}/download coming back with a File Not Found error. Other files that have InaccessibleOwnershipServer = false seem to work with the download function as expected. 
 
EDIT: Actually, no I still apparently can get download saying File Not Found even when /info comes back with 
InaccessibleOwnershipServer=false. So now I'm not really sure how to ensure a file downloads through the API. 
Message 3 of 3

Hi @imckenzieY7CGY , can you please open a Support ticket with few examples of API requests where you got the "File not found" error, so that we can investigate it further and see where is the problem? You can do this through the Contact Support page. Select Using and troubleshooting my software, then select Upchain from the dropdown menu. Someone from our support team will be in touch soon after.

 

One additional option you can try to do, is when calling endpoint to download file, to add optional parameter "syncFileToUsersVault" with value "true", e.g.

/api/bom/v1/file_version/{fileVersionId}/download?syncFileToUsersVault=true

I'm not sure if that will help, because it's hard to know root cause of the problem right now, but maybe setting this parameter would help (I'm guessing that problem might be that your default Vault might be different from Vault where file is located)



Sanjin Vuckovic
Software Development Engineer

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

Post to forums  

Autodesk Design & Make Report