Python API upload item with image inside same request

Hello everyone,
Since I had some issues with CSV Import, I’m trying to recreate the same functions using the API.
Is there a way to upload items alongside media without first posting the item and then the related media? Otherwise, I’ll upload them separately. I really appreciate any help you can provide! Thank you in advance

You can upload files in the same request as creating an item. Basically, the approach is to do the multipart upload as normal for uploading a file separately, and just include the JSON payload for the media you’re creating in the o:media key of the item creation JSON (omitting the “o:item” field from that media JSON).

o:media expects an array, so to create an item with a single media, you’d pass an array containing a single object there.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.