Solved

Media Library upload using REST : unsupported content type png, jpeg and octet-stream

  • 3 November 2022
  • 4 replies
  • 186 views

Userlevel 2
Badge +10
  • Hero (Customer)
  • 37 replies

Hi everyone!

I’m using POSTMAN to upload documents to IFS Cloud 21R2 and have successfully uploaded to the document manager with many thanks to the people who provided the detailed information in this topic:

 

My requirement is to upload to the media library rather than the docman so I’ve also looked at this topic (again, many thanks to the contributors):

I’ve used MediaLibraryAttachmentHandling.svc/CreateAndConnectMedia to get the ItemId and then I’ve tried to patch with MediaLibraryAttachmentHandling.svc/MediaLibrarySet(LibraryId='1013') and also MediaItemHandling.svc/MediaItemSet(ItemId=1013). Whatever I try to upload fails with unsupported content type.

I tried just providing a png or a jpg file and let POSTMAN set the headers:

 

Following the instructions in the above post I then specifically set the content type, if-match and X-IFS-Content-Disposition

 

I can successfully upload both png and jpg as media files as a user.

Thanks in advance for any suggestions!

icon

Best answer by Mathias Dahl 3 November 2022, 14:50

View original

4 replies

Userlevel 7
Badge +30

If you open Chrome's Dev Tools and keep the Network tab open you will see everything that is sent when the Aurena client does a media item upload. Did you try that, to see what headers it sets and what the values are?
 

Userlevel 2
Badge +10

Hi @Mathias Dahl 

Many thanks for your quick response.

I hadn’t looked there and I should have done!  I was using the wrong API to upload the file, I should have been using MediaLibraryAttachmentHandling.svc/MediaItemSet(ItemId=1013)/MediaObject with the appropriate headers for octet-stream.

Thanks again for pointing me in the right direction!

 

Userlevel 7
Badge +30

Great, thanks for reporting back. This thread might help others with the same or similar needs 💪🏻 

 

Userlevel 7
Badge +24

there’s an explainer document here: 

 

Reply