Delete a dish no meal uses
meals.dish.remove
POST/api/v1/households/{household_id}/commands/meals.dish.remove
- Command
- Rigel runs it
- Applies offline
Deletes the dish, its ingredients and any plate icons that include it. Fails with dish_in_use (saying how many meals) if a meal still has the dish; use meals.dish.merge to replace it with another dish instead.
Parameters#
| Field | Description |
|---|---|
household_idpathstringrequired | The household's ID. |
Idempotency-Keyheaderstringoptional | The command's ID. Reuse it when retrying the same command. |
Request body#
JSON, as application/json.
| Field | Description |
|---|---|
dish_idstringrequired | A dish ID, such as dsh_01JC0000000000000000000000. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
versionintegerrequired | The household version after the command. |
Errors#
Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.
| Status | Code | When |
|---|---|---|
400 | validation_failed | A field is missing, misspelled or out of range. details.fields lists each problem. |
401 | unauthenticated | The request has no valid session. |
404 | dish_not_found | A missing dish. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | dish_in_use | A dish in two meals is dish_in_use. |
409 | idempotency_key_reused | The Idempotency-Key was already used for a different command. |
Examples#
These are real. Each scenario is one of the command's test cases, run on a household when this site was built, and the response is what the API returned.
An unused dish goes with its ingredients and combo icons
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"dish_id": "dsh_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
dish_id: "dsh_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"dish_id": "dsh_01JC000000000000000000000A"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0KQ5D6EB30K3Q3VP2
{
"result": {},
"version": 1
}A dish in two meals is dish_in_use
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"dish_id": "dsh_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
dish_id: "dsh_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"dish_id": "dsh_01JC000000000000000000000A"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R01XAZJC24RV0TZHRY
{
"error": {
"code": "dish_in_use",
"message": "That dish is in 2 meals. No changes were applied.",
"details": {
"meal_count": 2
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R01XAZJC24RV0TZHRY"
}
}A missing dish
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"dish_id": "dsh_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
dish_id: "dsh_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.dish.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"dish_id": "dsh_01JC000000000000000000000A"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R03D551MKYAHRYDJ11
{
"error": {
"code": "dish_not_found",
"message": "That dish isn't there any more. No changes were applied.",
"details": {
"dish_id": "dsh_01JC000000000000000000000A"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R03D551MKYAHRYDJ11"
}
}Remove a dish nothing uses
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSHBX5D0CEQHRSHWFYJY' \
-d '{
"dish_id": "dsh_01M6V9CSH9R3VN2JFHSQQ5Q86Y"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSHBX5D0CEQHRSHWFYJY",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
dish_id: "dsh_01M6V9CSH9R3VN2JFHSQQ5Q86Y",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSHBX5D0CEQHRSHWFYJY
{
"dish_id": "dsh_01M6V9CSH9R3VN2JFHSQQ5Q86Y"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSHB6EXPM1GAABVHBZ3Q
{
"result": {},
"version": 85
}Remove a dish that's still planned
A dish can only go when no meal uses it. Merge it into another dish to replace it.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSHCQHG4W0DM2YGQJ3VN' \
-d '{
"dish_id": "dsh_01M6V9CSF42115AECDV14HYQ9G"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSHCQHG4W0DM2YGQJ3VN",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
dish_id: "dsh_01M6V9CSF42115AECDV14HYQ9G",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.dish.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSHCQHG4W0DM2YGQJ3VN
{
"dish_id": "dsh_01M6V9CSF42115AECDV14HYQ9G"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01M6V9CSHCPW59SR4G0K6A9GXM
{
"error": {
"code": "dish_in_use",
"message": "That dish is in 1 meal. No changes were applied.",
"details": {
"meal_count": 1
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01M6V9CSHCPW59SR4G0K6A9GXM"
}
}For Rigel#
Rigel's tool for this command is meals_dish_remove. Rigel runs this on its own, then says what it did. The agent guide has the rest.