Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

REST API - Retrieving an IMAGE

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mike.ponti
643 Views, 3 Replies

REST API - Retrieving an IMAGE

Hi,

I am looking for some advice on retrieving an IMAGE using the REST API. As a recap, I am able to log into PLM360, get the workspaces and see all of the items in the workspace. I am also able to retrieve the workspace details to get the field information for that workspace. From there, I can pick on an individual item, and display all of the data, except when it comes to IMAGE field types.

 

When I see the IMAGE field type, I look at the field value from the item and get the URL that I think would be used to retrieve the file.

i.e. "https://xxxxx.autodeskplm360.net/api/v2/workspaces/47/items/2694/field-values/IMAGE"

 

Using the restsharp library, I take the URL, add the same cookies that I have always been adding to each of my calls. For regular data, I have been adding

accept: application/json

 

to the request headers. For the image call, I have been adding

accept: image/jpeg

 

I execute the request and just receive the standard NotFound error and get back the normal error page as if I had been browsing manually. This happens on any item that has an image attached to it.

 

I can't help but feel like I am missing something blindingly obviously.

 

Thanks

Mike

3 REPLIES 3
Message 2 of 4
Redmond.D
in reply to: mike.ponti

I don't think you need to specify the accept types when reading an image field.

If you want some sample code grab the handout and additional materials for the AU class: Programming Autodesk PLM 360 Using REST

The materials go over a bunch of workflows related to binary data, including downloading an image.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 4
mike.ponti
in reply to: mike.ponti

Thanks Doug, I will rework my code as you have in the sample and see how it goes. On the surface, the only real difference I see is that I was using the URL that was provided in the field value instead of constructing the URL manually as in your sample.

 

Thanks

Mike

Message 4 of 4
mike.ponti
in reply to: mike.ponti

Hi Doug,

Just an update on this. Looks like my url's were correct. Where it was coming apart was the fact that I was using the RestSharp library to handle my rest calls and I think it was defaulting some deserialization handlers into the request. I think this then put in some additional headers which caused the "Not Found" error (not totally sure about that). 

 

When I removed the handlers before making the call, it would then return the binary content.

 

Thanks for your help,

Mike

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

Post to forums  

Autodesk Design & Make Report