Change when Rigel plans the week, or when a plan week starts
meals.setting.update
POST/api/v1/households/{household_id}/commands/meals.setting.update
- Command
- Rigel runs it
- Applies offline
Sets only the fields given: planning_weekday and planning_time (when Rigel fills the coming week, in the household's time zone), week_starts_on (the first day of a plan week), and is_auto_planning_on (false stops Rigel planning on its own).
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 |
|---|---|
planning_weekdayintegeroptional | The day Rigel plans the coming week, 1 = Monday … 7 = Sunday. |
planning_timestringoptional | A local time of day in the household's time zone, "HH:MM" on a 24-hour clock, such as "09:00". |
week_starts_onintegeroptional | The first day of a plan week, 1 = Monday … 7 = Sunday. |
is_auto_planning_onbooleanoptional | Whether Rigel fills the week on the planning day. |
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 | not_found | The household doesn't exist, or you aren't a member of it. |
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.
The first change creates the one row with the defaults for the rest
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"planning_weekday": 5
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
planning_weekday: 5,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"planning_weekday": 5
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R05J0FZE3P1WGA1J8Y
{
"result": {},
"version": 1
}Turning auto planning off on a new row
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"is_auto_planning_on": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
is_auto_planning_on: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"is_auto_planning_on": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YBN2GVWE96BSF2SS
{
"result": {},
"version": 1
}Later changes update only what's given
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"planning_time": "18:30",
"week_starts_on": 7
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
planning_time: "18:30",
week_starts_on: 7,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/meals.setting.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"planning_time": "18:30",
"week_starts_on": 7
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R02H0EV91Z5PSATVM4
{
"result": {},
"version": 1
}Plan the week on Friday afternoons
planning_weekday counts from 0 on Sunday. Rigel fills the coming week then, in the household's time zone.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.setting.update' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSF3P381CD2ZYXCPXN7V' \
-d '{
"planning_weekday": 5,
"planning_time": "17:00"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.setting.update", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSF3P381CD2ZYXCPXN7V",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
planning_weekday: 5,
planning_time: "17:00",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/meals.setting.update HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSF3P381CD2ZYXCPXN7V
{
"planning_weekday": 5,
"planning_time": "17:00"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSF30SE7SHEBRFGF8Z3C
{
"result": {},
"version": 68
}For Rigel#
Rigel's tool for this command is meals_setting_update. Rigel runs this on its own, then says what it did. The agent guide has the rest.