Skip to content

Update a product detail

PATCH
/product-details/{id}
curl --request PATCH \
--url https://example.com/product-details/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f \
--header 'Content-Type: application/json' \
--cookie __Host-bottle.session_token=<__Host-bottle.session_token> \
--data '{ "name": "example", "multiple": true, "unit": "example", "kinds": [ "cylinder" ], "options": [ { "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "label": "example", "archived": true } ], "archived": true }'

Rename it, change its unit or the kinds of product it is for, rename, reorder, add or archive options, or archive the detail. Its type and key stay as they were. Nothing deletes a value a product has.

id
required

UUID v7

string format: uuid

Example

019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f

UUID v7

Media typeapplication/json
object
name
string
>= 1 characters <= 60 characters
multiple

On a choice. Turning it off is refused while a product has more than one option (error: detail_has_several).

boolean
unit
string | null
<= 12 characters
kinds

The kinds of product it applies to. Null or left out: every product.

Array<string> | null
>= 1 items <= 9 items
Allowed values: cylinder deposit hire accessory appliance fuel consumable delivery other
options

On a choice: the options in their new order. An option with an id is renamed, moved or archived; one without is added. An option left out is kept as it was, after those sent. Options are never deleted, so the products that have one keep it.

Array<object>
<= 100 items
object
id

An existing option. Left out: a new one.

string format: uuid

Example

019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f
label
required
string
>= 1 characters <= 60 characters
archived
boolean
archived

Archiving takes the detail off the product form and the shop. Values on products are kept and come back with it.

boolean

Updated

Media typeapplication/json
object
id
required

UUID v7

string format: uuid
name
required
string
key
required

In the shop’s filter addresses: /products?d-regulator-fitting=clip-on. Made from the name when the detail is created and kept when it is renamed, so shared links keep working. Unique within the business.

string
type
required

Choice: one of a list of options, or several when multiple is true. number: a number, in the fixed unit set on the detail, such as kg. yesno: yes or no. text: a short line of text, shown on the product and not a filter.

string
Allowed values: choice number yesno text
multiple
required

On a choice: whether a product can have several options. False otherwise.

boolean
unit
required

On a number: the unit it is in, as shown after it. Null when there is none.

string | null
kinds
required

The kinds of product it applies to. Null: every product.

Array<string> | null
Allowed values: cylinder deposit hire accessory appliance fuel consumable delivery other
options
required

On a choice: its options in order, archived ones included. Empty otherwise.

Array<object>
object
id
required

UUID v7

string format: uuid
label
required
string
archivedAt
required

Archived options are kept on the products that have them and are not offered for new ones.

string | null format: date-time
sortOrder
required
integer
archivedAt
required
string | null format: date-time
createdAt
required
string format: date-time
updatedAt
required
string format: date-time

Example

{
"id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"name": "Regulator fitting",
"key": "regulator-fitting",
"type": "choice",
"unit": "kg",
"kinds": [
"cylinder"
],
"options": [
{
"id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"label": "Clip-on"
}
]
}

Not signed in

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

Not a member, or without the permission this needs

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

No such product detail

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

Turning off several options while a product has more than one (error: conflict)

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

Validation failed

Media typeapplication/json
object
error
required
string
Allowed values: validation
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string

Example

{
"error": "validation",
"issues": [
{
"path": "email",
"message": "Invalid email"
}
]
}