Update Menu Item At Location
PATCH /v1/nextrestaurant/locations/{locationId}/menu-items/{itemId}
86 an item, switch it off, or override its price at one location
Needs menu:write. The same per-location settings as the admin menu screen.
A change in whether the item can be ordered fires
menu_item.availability_changed. Refused in demo mode.
Request
PATCH https://your-site.example/api/index.php/v1/nextrestaurant/locations/{locationId}/menu-items/{itemId}
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
locationId |
integer |
path |
Yes | (min 1) |
itemId |
integer |
path |
Yes | (min 1) |
If-Match |
string |
header |
No | The ETag from your last read. When the record has changed since, the change is refused with 412 PRECONDITION_FAILED instead of overwriting someone else's edit. Without it, the last write wins. |
Idempotency-Key |
string |
header |
No | Any unique string up to 255 characters, e.g. a UUID. Send the same key when retrying after a timeout: the first response is replayed (with Idempotent-Replayed: true) and nothing happens twice. Reusing a key for a different request is 422 IDEMPOTENCY_MISMATCH; while the first request is still running it is 409 IDEMPOTENCY_IN_PROGRESS. Keys are kept 24 hours, per API key. (max length 255) |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
available |
boolean |
No | false switches the item off at this location. |
is_86 |
boolean |
No | |
eighty_six_reason |
string|null |
No | (max length 255) |
eighty_six_until |
string|null |
No | UTC date-time when the 86 lifts. |
price_override |
number|null |
No | null returns to the base price. (min 0) |
{
"is_86": true,
"eighty_six_reason": "Out of salmon"
}
Responses
200 — The item at the location.
{
"data": {
"item_id": 1,
"location_id": 1,
"title": "string",
"base_price": 1.5,
"price": 1.5,
"price_override": 1.5,
"published": true,
"available": true,
"is_86": true,
"eighty_six_until": "string",
"eighty_six_reason": "string",
"updated_at": "string"
}
}
| Field | Type | Meaning |
|---|---|---|
data.item_id |
integer |
|
data.location_id |
integer |
|
data.title |
string |
|
data.base_price |
number |
|
data.price |
number |
What the item sells for here. |
data.price_override |
number|null |
|
data.published |
boolean |
|
data.available |
boolean |
Can be ordered at this location right now. |
data.is_86 |
boolean |
|
data.eighty_six_until |
string|null |
|
data.eighty_six_reason |
string|null |
|
data.updated_at |
string|null |
Errors
| Status | Code | When |
|---|---|---|
400 |
INVALID_JSON |
INVALID_JSON (the body is not a JSON object) or INVALID_IDEMPOTENCY_KEY. |
401 |
INVALID_TOKEN |
The token is missing, wrong, or none has been generated. |
403 |
INSUFFICIENT_SCOPE |
This API key does not have the permission this request needs. |
403 |
MODULE_DISABLED |
This module is disabled. |
403 |
API_DISABLED |
API is disabled |
404 |
NOT_FOUND |
No such record. |
412 |
PRECONDITION_FAILED: the record changed since your If-Match. Read it again. |
|
415 |
UNSUPPORTED_MEDIA_TYPE: send Content-Type: application/json. |
|
422 |
VALIDATION_FAILED |
One error per invalid field, each with source.pointer. |
429 |
RATE_LIMITED |
Too many requests. RATE_LIMITED with a Retry-After header: this key used its budget for the minute, or this address sent 20 bad tokens in 5 minutes. Nothing ran, so the request is safe to retry after the wait. |
Examples
curl
curl -s -X PATCH "https://your-site.example/api/index.php/v1/nextrestaurant/locations/1/menu-items/1" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_86":true,"eighty_six_reason":"Out of salmon"}'
PHP
<?php
$ch = curl_init('https://your-site.example/api/index.php/v1/nextrestaurant/locations/1/menu-items/1');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('API_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{"is_86":true,"eighty_six_reason":"Out of salmon"}',
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
JavaScript
const API_TOKEN = process.env.API_TOKEN;
const response = await fetch("https://your-site.example/api/index.php/v1/nextrestaurant/locations/1/menu-items/1", {
method: 'PATCH',
headers: {
"Authorization": `Bearer ${API_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"is_86": true,
"eighty_six_reason": "Out of salmon"
}),
});
const data = await response.json();