How do I add images or other media to a device programmatically?

We expose an Add Media button while a session is active in order to add media files into the device photo library. This works on both Android and iOS. You can try this out via our demo once you start a session.

We expose an Add Media button while a session is active in order to add media files into the device photo library. This works on both Android and iOS. 

You can try this out via our demo once you start a session at https://appetize.io/demo. Here's a screenshot of what it looks like.

KB_AddImageProgrammatically


Please find the instructions below if you would like to add media programmatically, for example if you have embedded Appetize.io device into your own website. 

Please first enable xdocMsg=true in your app's URL as documented at https://docs.appetize.io. This will allow you to listen for the sessionConnecting message, where you can retrieve the connectionString ("path") and sessionToken ("token") in Javascript when a session is started. 

To upload a media file to the device, you may POST the file (direct raw binary, no http multipart or encoding) to the connectionString/session/TOKEN/addMedia (using AJAX, or via your backend).

e.g. https://eu-android-2.appetize.io/session/47b921f6191b01a7f169da1953da60e2eb5675b63820b0f545a412db16eccbb4/addMedia

Required: the Content-Type header should be "image/jpeg", "image/gif", or "image/png". There is a 50 megabyte size limit.