Add a picture to a product
const url = 'https://example.com/products/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f/images';const options = { method: 'POST', headers: { cookie: 'bottle.session_token=<bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"dataUrl":"example","alt":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/products/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f/images \ --header 'Content-Type: application/json' \ --cookie bottle.session_token=<bottle.session_token> \ --data '{ "dataUrl": "example", "alt": "example" }'Added last. A JPEG, PNG, WebP, AVIF or GIF (its first frame) as a data URL, up to 15 MB and 40 megapixels, and within the request size limit of 8 MB. It is turned the right way up, everything in the file that is not the picture (camera details, where it was taken) is taken out, and sizes of 200, 600 and 1600 pixels are made, never bigger than the picture. At most 12 a product.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”UUID v7
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8fUUID v7
Request Bodyrequired
Section titled “Request Bodyrequired”object
The picture as a data URL: JPEG, PNG, WebP, AVIF or the first frame of a GIF, up to 15 MB and 40 megapixels. Turned upright, stripped of everything but the pixels, and kept with sizes made for the shop.
Examplegenerated
{ "dataUrl": "example", "alt": "example"}Responses
Section titled “Responses”The picture
object
UUID v7
What the picture shows, for screen readers and search.
Of the original, in pixels.
Fits inside 200 pixels. WebP.
Fits inside 600 pixels. WebP.
Fits inside 1600 pixels. WebP.
Example
{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f"}Not signed in
object
Example
{ "error": "not_found", "message": "Customer not found"}Not a member, or without the permission this needs
object
Example
{ "error": "not_found", "message": "Customer not found"}No such product or picture
object
Example
{ "error": "not_found", "message": "Customer not found"}The product already has 12 pictures
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed, or the file is not a picture Bottle takes
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}