Use some of an item, or add some
inventory.item.adjust
POST/api/v1/households/{household_id}/commands/inventory.item.adjust
- Command
- Rigel runs it
- Applies offline
Changes the amount by a delta (negative when some was used), or sets a level ("about half", "low"). When the quantity reaches zero or below the item is removed and removed is true. A delta on an item that has no quantity (only a level, or just "some") fails with no_quantity; use inventory.item.set_amount or a level instead. A level replaces any quantity. Counts as seen now, or at confirmed_at, and never moves the item's confirmation backwards. Errors: item_not_found, no_quantity.
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 | The item to change. |
deltanumberoptional | How much to add to the quantity, in its own unit; negative to use some (-1, or -0.5 for half a pound). Not 0, at most 1,000,000 either way. Give this or level. |
levelone of: full, most, half, lowoptional | Set a rough level instead, which clears any number. Give this or delta. |
confirmed_atstring (date-time)optional | When this was known to be true, if not now: for a photo, when it was taken. A time after the command is treated as now, and an item's confirmation never moves backwards. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.removedbooleanrequired | True when nothing was left and the item was deleted. |
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 | item_not_found |
|
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | no_quantity |
|
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.
Using one leaves the rest and confirms the item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00P9PSVKD5NKQNC51
{
"result": {
"removed": false
},
"version": 1
}Adding some
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": 3
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: 3,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": 3
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0KCPG5YMVFKZKKG37
{
"result": {
"removed": false
},
"version": 1
}A fraction of a pound
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -0.5
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -0.5,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -0.5
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R060DEGF4P4TNKP21W
{
"result": {
"removed": false
},
"version": 1
}Rounds to six decimals
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": 0.2
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: 0.2,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": 0.2
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00R9GHR0R0AESWJX0
{
"result": {
"removed": false
},
"version": 1
}A remainder under a millionth rounds to zero and the item is gone
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -0.9999999
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -0.9999999,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -0.9999999
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0EF13GBPWDK00K2YE
{
"result": {
"removed": true
},
"version": 1
}Using exactly what is left removes the item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R052AXW58DSKBMVTFM
{
"result": {
"removed": true
},
"version": 1
}Using more than is left removes the item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -5
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -5,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -5
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R099HB9HAKF3VFZY41
{
"result": {
"removed": true
},
"version": 1
}A level replaces the quantity and its unit
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"level": "low"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
level: "low",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"level": "low"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0SPDP0W9FA4RPMTEC
{
"result": {
"removed": false
},
"version": 1
}A level replaces a level
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"level": "half"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
level: "half",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"level": "half"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0TQ4EKMGAJMMNSJC5
{
"result": {
"removed": false
},
"version": 1
}Confirmed_at earlier than the item's own does not move it back
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1,
"confirmed_at": "2025-11-01T12:26:40.000Z"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -1,
confirmed_at: "2025-11-01T12:26:40.000Z",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1,
"confirmed_at": "2025-11-01T12:26:40.000Z"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XGMVQZSF994Z9ZTE
{
"result": {
"removed": false
},
"version": 1
}Confirmed_at later than the item's own moves it forward
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1,
"confirmed_at": "2025-11-04T23:46:40.000Z"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -1,
confirmed_at: "2025-11-04T23:46:40.000Z",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1,
"confirmed_at": "2025-11-04T23:46:40.000Z"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0058YJGPZ0XEPMY6Z
{
"result": {
"removed": false
},
"version": 1
}Confirmed_at in the future counts as now
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1,
"confirmed_at": "2026-11-06T19:20:00.000Z"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -1,
confirmed_at: "2026-11-06T19:20:00.000Z",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1,
"confirmed_at": "2026-11-06T19:20:00.000Z"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R09EP9GX3CTDXD31KA
{
"result": {
"removed": false
},
"version": 1
}A delta on an item with only a level
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": -1
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R02460NEYT22WJ3AJE
{
"error": {
"code": "no_quantity",
"message": "That item has no number to change. Use inventory.item.set_amount to give it a quantity, or adjust it with a level. No changes were applied.",
"details": {
"item_id": "inv_01JC000000000000000000000A"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R02460NEYT22WJ3AJE"
}
}A delta on an item we only have some of
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000A",
"delta": 1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000A",
delta: 1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000A",
"delta": 1
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0BSC7RPY5XHP8FM92
{
"error": {
"code": "no_quantity",
"message": "That item has no number to change. Use inventory.item.set_amount to give it a quantity, or adjust it with a level. No changes were applied.",
"details": {
"item_id": "inv_01JC000000000000000000000A"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0BSC7RPY5XHP8FM92"
}
}An unknown item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"item_id": "inv_01JC000000000000000000000Z",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01JC000000000000000000000Z",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"item_id": "inv_01JC000000000000000000000Z",
"delta": -1
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0CB5QR9W0M4AF29NP
{
"error": {
"code": "item_not_found",
"message": "That item isn't in the inventory any more. No changes were applied.",
"details": {
"item_id": "inv_01JC000000000000000000000Z"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0CB5QR9W0M4AF29NP"
}
}Use one of something
A negative delta takes some; a positive one adds.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSC8V28X1K79ZY1PJD71' \
-d '{
"item_id": "inv_01M6V9CSAPM8JH7W1W1YEBHPRS",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSC8V28X1K79ZY1PJD71",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01M6V9CSAPM8JH7W1W1YEBHPRS",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSC8V28X1K79ZY1PJD71
{
"item_id": "inv_01M6V9CSAPM8JH7W1W1YEBHPRS",
"delta": -1
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSC87E29XDMBQX0TAM36
{
"result": {
"removed": false
},
"version": 38
}Use the last of something
When the amount reaches zero the item is removed, and removed is true.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSCBXPXZASR1QNMHV1S1' \
-d '{
"item_id": "inv_01M6V9CSB6S923R566WD7EAGGG",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSCBXPXZASR1QNMHV1S1",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01M6V9CSB6S923R566WD7EAGGG",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSCBXPXZASR1QNMHV1S1
{
"item_id": "inv_01M6V9CSB6S923R566WD7EAGGG",
"delta": -1
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSCB8JG881MDXCX4WNPP
{
"result": {
"removed": true
},
"version": 39
}Say how full something is now
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSCCW4QGCT7H0GA80G74' \
-d '{
"item_id": "inv_01M6V9CSB0YB2Y7WBZBMR3G5Z0",
"level": "low"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSCCW4QGCT7H0GA80G74",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01M6V9CSB0YB2Y7WBZBMR3G5Z0",
level: "low",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSCCW4QGCT7H0GA80G74
{
"item_id": "inv_01M6V9CSB0YB2Y7WBZBMR3G5Z0",
"level": "low"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSCCZXMPRV62FZ5DK0S9
{
"result": {
"removed": false
},
"version": 40
}Use some of something with no count
An item tracked by level has no number to subtract from. Set a level instead, or give it an amount first.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSCAQFTGPZHMD059CZET' \
-d '{
"item_id": "inv_01M6V9CSATNBB6KZZ14ZN1FE15",
"delta": -1
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSCAQFTGPZHMD059CZET",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
item_id: "inv_01M6V9CSATNBB6KZZ14ZN1FE15",
delta: -1,
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/inventory.item.adjust HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSCAQFTGPZHMD059CZET
{
"item_id": "inv_01M6V9CSATNBB6KZZ14ZN1FE15",
"delta": -1
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01M6V9CSCARJ6QD08PRWCJV03H
{
"error": {
"code": "no_quantity",
"message": "That item has no number to change. Use inventory.item.set_amount to give it a quantity, or adjust it with a level. No changes were applied.",
"details": {
"item_id": "inv_01M6V9CSATNBB6KZZ14ZN1FE15"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01M6V9CSCARJ6QD08PRWCJV03H"
}
}For Rigel#
Rigel's tool for this command is inventory_item_adjust. Rigel runs this on its own, then says what it did. The agent guide has the rest.