Check an item off the list (got it), or put it back
shopping.item.check
POST/api/v1/households/{household_id}/commands/shopping.item.check
- Command
- Rigel runs it
- Applies offline
is_checked true: the shopper got it. It's marked with who and when, and with store_id when the shopper is in a store, so that store's trip picks it up when finished. Checking an item that's already checked changes nothing, so the first shopper's store keeps it. is_checked false: puts it back on the list as still to get. If the same product was added again meanwhile, the two become one item. Returns the item that remains.
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 |
|---|---|
item_idstringrequired | A shopping list item ID, such as shi_01JC0000000000000000000000. |
is_checkedbooleanrequired | True: got it. False: put it back on the list as still to get. |
store_idstring or nulloptional | The store the shopper is in, so the item joins that store's trip. Leave out when not in a store. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.item_idstringrequired | The item that remains: this one, or the one it was merged into. |
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 | shopping_item_not_found | An unknown item is refused. |
404 | store_not_found | An unknown store is refused. |
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.
Checking records when, by whom and at which store
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true,
"store_id": "sto_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: true,
store_id: "sto_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true,
"store_id": "sto_01JC000000000000000000000A"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0RWXXMQDHRAHPNNKS
{
"result": {
"item_id": "shi_01JC0000000000000000000001"
},
"version": 1
}Checking with no store leaves the store empty
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: true,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0N9JES6Z6YH2BER9B
{
"result": {
"item_id": "shi_01JC0000000000000000000001"
},
"version": 1
}Checking an item that's already checked changes nothing, so the first store keeps it
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true,
"store_id": "sto_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: true,
store_id: "sto_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true,
"store_id": "sto_01JC000000000000000000000A"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0ZMJ9Y5WEBWYNANT1
{
"result": {
"item_id": "shi_01JC0000000000000000000001"
},
"version": 1
}An actor with no person checks with no checked_by
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: true,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0DZM70PPARFQCTN9S
{
"result": {
"item_id": "shi_01JC0000000000000000000001"
},
"version": 1
}Un-checking puts it back as still to get
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00XAS1B702XFJRY06
{
"result": {
"item_id": "shi_01JC0000000000000000000001"
},
"version": 1
}Un-checking an item that isn't checked changes nothing
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R011WMDM257NHFKVPA
{
"result": {
"item_id": "shi_01JC0000000000000000000001"
},
"version": 1
}Un-checking after the product was added again merges the two into the new item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0FMHD2174FQXYYW1C
{
"result": {
"item_id": "shi_01JC0000000000000000000002"
},
"version": 1
}An unknown item is refused
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: true,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R077SWDQX7DF6C3EFN
{
"error": {
"code": "shopping_item_not_found",
"message": "That item isn't on the list any more. No changes were applied.",
"details": {
"item_id": "shi_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R077SWDQX7DF6C3EFN"
}
}An unknown store is refused
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true,
"store_id": "sto_01JC000000000000000000000Z"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01JC0000000000000000000001",
is_checked: true,
store_id: "sto_01JC000000000000000000000Z",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "shi_01JC0000000000000000000001",
"is_checked": true,
"store_id": "sto_01JC000000000000000000000Z"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0CGTR4ZTFVXQDHJST
{
"error": {
"code": "store_not_found",
"message": "That store isn't there any more. No changes were applied.",
"details": {
"store_id": "sto_01JC000000000000000000000Z"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0CGTR4ZTFVXQDHJST"
}
}Check an item off at a store
The trip to this store picks it up when it's finished.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CT8DH7A875YR3QD6BPTG' \
-d '{
"item_id": "shi_01M6V9CT7DFWJ9QA55E2RH41NS",
"is_checked": true,
"store_id": "sto_01M6V9CT6QQBTTA6DBQXS60NCD"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CT8DH7A875YR3QD6BPTG",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01M6V9CT7DFWJ9QA55E2RH41NS",
is_checked: true,
store_id: "sto_01M6V9CT6QQBTTA6DBQXS60NCD",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT8DH7A875YR3QD6BPTG
{
"item_id": "shi_01M6V9CT7DFWJ9QA55E2RH41NS",
"is_checked": true,
"store_id": "sto_01M6V9CT6QQBTTA6DBQXS60NCD"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CT8D1BJMMDMCHESG0D11
{
"result": {
"item_id": "shi_01M6V9CT7DFWJ9QA55E2RH41NS"
},
"version": 281
}Put an item back on the list
is_checked false puts it back as still to get.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.item.check' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CT8H0CTE120BY5GQXA7V' \
-d '{
"item_id": "shi_01M6V9CT7NDTGH8Q6235X75TRQ",
"is_checked": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.item.check", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CT8H0CTE120BY5GQXA7V",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "shi_01M6V9CT7NDTGH8Q6235X75TRQ",
is_checked: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/shopping.item.check HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT8H0CTE120BY5GQXA7V
{
"item_id": "shi_01M6V9CT7NDTGH8Q6235X75TRQ",
"is_checked": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CT8H6XH2X57219XHWA2X
{
"result": {
"item_id": "shi_01M6V9CT7NDTGH8Q6235X75TRQ"
},
"version": 284
}For Rigel#
Rigel's tool for this command is shopping_item_check. Rigel runs this on its own, then says what it did. The agent guide has the rest.