Create a shop category
const url = 'https://example.com/categories';const options = { method: 'POST', headers: { cookie: 'bottle.session_token=<bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"name":"example","slug":"example","description":"example","imageDataUrl":"example","sortOrder":1}'};
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/categories \ --header 'Content-Type: application/json' \ --cookie bottle.session_token=<bottle.session_token> \ --data '{ "name": "example", "slug": "example", "description": "example", "imageDataUrl": "example", "sortOrder": 1 }'The address (slug) is made from the name unless one is given, with a number added when it is already used in this business. Goes last in the order unless sortOrder says otherwise. A tile picture can be sent as a data URL; it is kept with sizes made for the shop.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Left out, made from the name. A number is added when it is taken.
A tile picture as a data URL (JPEG, PNG, WebP, AVIF or GIF, up to 15 MB). On an update, null takes the picture away.
Examplegenerated
{ "name": "example", "slug": "example", "description": "example", "imageDataUrl": "example", "sortOrder": 1}Responses
Section titled “Responses”Created
object
UUID v7
In the shop’s address: /c/bottled-gas. Unique within the business.
The tile picture at three sizes, WebP. Null when there is none.
object
Example
{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "name": "Bottled gas", "slug": "bottled-gas"}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"}The slug asked for is already used in this business
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed, or the picture is not one Bottle takes
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}