Record a part or consumable
maintenance.part.add
POST/api/v1/households/{household_id}/commands/maintenance.part.add
- Command
- Rigel runs it
- Applies offline
Records a replacement part or consumable, such as a furnace filter. When manufacturer and part_number are both given and the household already has that part, it is reused unchanged, except that a product is filled in when it had none (use maintenance.part.update to change it); otherwise a new part is made. fits says which models or items it fits; a fit that already exists is left as it is. Give a product when the household keeps spares or buys it again. Errors: product_not_found.
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 |
|---|---|
namestringrequired | What it is, as the package says: "Furnace filter 16x25x1 MERV 11". |
manufacturerstringoptional | The maker of the part. |
part_numberstringoptional | The part number exactly as printed, with every suffix and letter case. |
descriptionstringoptional | Size, how many the equipment takes, and anything else that matters when buying it. |
is_oembooleanoptional | True when the equipment's maker makes or specifies it, false for a compatible part. Leave it out when unknown. |
purchase_urlstring (uri)optional | One place to buy it. A link doesn't prove it fits. |
product_idstringoptional | The inventory product this part is, when the household keeps spares or buys it again: the filters on the shelf are inventory items of that product. |
product_namestringoptional | Instead of product_id, the product in the household's words, such as "Furnace filter 16x25x1". An existing product with that name (ignoring case) is used, or a new one is made. |
fitsarray of objectsoptional | What the part fits. |
fits[].model_idstringoptional | The model it fits, so every item of that model shares it. |
fits[].asset_idstringoptional | The one item it fits. |
fits[].evidenceobjectoptional | Where it was found that the part fits: the manual, a page, a person. |
fits[].evidence.file_idstringoptional | A photo, manual or invoice already uploaded to the household's files. |
fits[].evidence.urlstring (uri)optional | A web address. |
fits[].evidence.said_by_person_idstringoptional | Who said it, when the source is something a person said. |
fits[].evidence.locatorstringoptional | Where in the source: "p. 14", "rating plate". |
fits[].evidence.excerptstringoptional | The exact text the value was read from. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.part_idstringrequired | The part, new or already recorded. |
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 | product_not_found |
|
404 | model_not_found | A model that isn't there. |
404 | asset_not_found | An item that isn't there. |
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.
Records a part
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter 16x25x1",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"description": "One per change",
"is_oem": false,
"purchase_url": "https://example.com/filter"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter 16x25x1",
manufacturer: "Filtrete",
part_number: "1900-4",
description: "One per change",
is_oem: false,
purchase_url: "https://example.com/filter",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter 16x25x1",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"description": "One per change",
"is_oem": false,
"purchase_url": "https://example.com/filter"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R06VB2WJ9RCAGWP1GE
{
"result": {
"part_id": "prt_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Is_oem true is stored as 1 and unknown as null
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Igniter",
"is_oem": true
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Igniter",
is_oem: true,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Igniter",
"is_oem": true
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XP82NAY4RYRCZ82C
{
"result": {
"part_id": "prt_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Fits a model and an item, with evidence on one
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001",
"evidence": {
"locator": "manual p. 12"
}
},
{
"asset_id": "ast_01JC0000000000000000000001"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter",
fits: [
{
model_id: "eqm_01JC0000000000000000000001",
evidence: {
locator: "manual p. 12",
},
},
{
asset_id: "ast_01JC0000000000000000000001",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001",
"evidence": {
"locator": "manual p. 12"
}
},
{
"asset_id": "ast_01JC0000000000000000000001"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0P4M88SYEFYGFXTBK
{
"result": {
"part_id": "prt_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}The same manufacturer and part number is the same part, left as it is
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Renamed",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Renamed",
manufacturer: "Filtrete",
part_number: "1900-4",
fits: [
{
model_id: "eqm_01JC0000000000000000000001",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Renamed",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0Q6GBAYD49K12PN8P
{
"result": {
"part_id": "prt_01JC0000000000000000000001"
},
"version": 1
}A fit that already exists is left alone
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter",
manufacturer: "Filtrete",
part_number: "1900-4",
fits: [
{
model_id: "eqm_01JC0000000000000000000001",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0N7BVJHRVEG6HFN94
{
"result": {
"part_id": "prt_01JC0000000000000000000001"
},
"version": 1
}A part number alone doesn't identify a part
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Other filter",
"part_number": "1900-4"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Other filter",
part_number: "1900-4",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Other filter",
"part_number": "1900-4"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0TD7KRB9VBN6J7WHW
{
"result": {
"part_id": "prt_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}The case of a part number counts
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Other filter",
"manufacturer": "Filtrete",
"part_number": "AB-1"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Other filter",
manufacturer: "Filtrete",
part_number: "AB-1",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Other filter",
"manufacturer": "Filtrete",
"part_number": "AB-1"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0H0HW1Q6708YXY457
{
"result": {
"part_id": "prt_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Names a product in the household's words, made when it's new
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter 16x25x1 MERV 11",
"product_name": "Furnace filter 16x25x1"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter 16x25x1 MERV 11",
product_name: "Furnace filter 16x25x1",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter 16x25x1 MERV 11",
"product_name": "Furnace filter 16x25x1"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0753KVPX5RZMKGS3W
{
"result": {
"part_id": "prt_01JC4N0000VGW1STJ6TGXRB7FY"
},
"version": 1
}A product named like one the household has is that product, ignoring case
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter 16x25x1",
"product_name": "Furnace Filter 16x25x1"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter 16x25x1",
product_name: "Furnace Filter 16x25x1",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter 16x25x1",
"product_name": "Furnace Filter 16x25x1"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R06CGVT5RVP69WXC3Z
{
"result": {
"part_id": "prt_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}A part the household has gets the product when it had none
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter 16x25x1",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"product_id": "prd_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter 16x25x1",
manufacturer: "Filtrete",
part_number: "1900-4",
product_id: "prd_01JC0000000000000000000001",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter 16x25x1",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"product_id": "prd_01JC0000000000000000000001"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0QA01Q43FY5FM2HE9
{
"result": {
"part_id": "prt_01JC0000000000000000000001"
},
"version": 1
}A part the household has keeps the product it has
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"product_id": "prd_01JC0000000000000000000002"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter",
manufacturer: "Filtrete",
part_number: "1900-4",
product_id: "prd_01JC0000000000000000000002",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter",
"manufacturer": "Filtrete",
"part_number": "1900-4",
"product_id": "prd_01JC0000000000000000000002"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0QHTGJ47Z03EDBTJP
{
"result": {
"part_id": "prt_01JC0000000000000000000001"
},
"version": 1
}A model that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter",
fits: [
{
model_id: "eqm_01JC0000000000000000000001",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter",
"fits": [
{
"model_id": "eqm_01JC0000000000000000000001"
}
]
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0RR9BFSPZ7067Z2DM
{
"error": {
"code": "model_not_found",
"message": "That model isn't recorded any more. No changes were applied.",
"details": {
"model_id": "eqm_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0RR9BFSPZ7067Z2DM"
}
}An item that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter",
"fits": [
{
"asset_id": "ast_01JC0000000000000000000001"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter",
fits: [
{
asset_id: "ast_01JC0000000000000000000001",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter",
"fits": [
{
"asset_id": "ast_01JC0000000000000000000001"
}
]
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0DV4G698WXNNK07NS
{
"error": {
"code": "asset_not_found",
"message": "That item isn't in the house records any more. No changes were applied.",
"details": {
"asset_id": "ast_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0DV4G698WXNNK07NS"
}
}A product that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"name": "Filter 16x25x1",
"product_id": "prd_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Filter 16x25x1",
product_id: "prd_01JC0000000000000000000001",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"name": "Filter 16x25x1",
"product_id": "prd_01JC0000000000000000000001"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R05D958TBZ8Z1ERJRA
{
"error": {
"code": "product_not_found",
"message": "That product isn't there any more. No changes were applied.",
"details": {
"product_id": "prd_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R05D958TBZ8Z1ERJRA"
}
}Record a part that fits an item
product_name ties it to a product in Inventory, so the shelf and the shopping list can answer for it.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.part.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSWCA3JQWGVR7BMSFPEK' \
-d '{
"name": "Furnace filter 16x25x1 MERV 11",
"manufacturer": "Aerofresh",
"part_number": "AF-1625-M11",
"description": "The furnace takes one. They come in packs of four.",
"is_oem": false,
"product_name": "Furnace filter 16x25x1",
"fits": [
{
"asset_id": "ast_01M6V9CSVCMZFAP6ZN5WANZ6M8"
}
]
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.part.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSWCA3JQWGVR7BMSFPEK",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
name: "Furnace filter 16x25x1 MERV 11",
manufacturer: "Aerofresh",
part_number: "AF-1625-M11",
description: "The furnace takes one. They come in packs of four.",
is_oem: false,
product_name: "Furnace filter 16x25x1",
fits: [
{
asset_id: "ast_01M6V9CSVCMZFAP6ZN5WANZ6M8",
},
],
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.part.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSWCA3JQWGVR7BMSFPEK
{
"name": "Furnace filter 16x25x1 MERV 11",
"manufacturer": "Aerofresh",
"part_number": "AF-1625-M11",
"description": "The furnace takes one. They come in packs of four.",
"is_oem": false,
"product_name": "Furnace filter 16x25x1",
"fits": [
{
"asset_id": "ast_01M6V9CSVCMZFAP6ZN5WANZ6M8"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSWCDR7DJE12VGYH5SCA
{
"result": {
"part_id": "prt_01M6V9CSWCCK3TQDA78RGRZ2E2"
},
"version": 190
}For Rigel#
Rigel's tool for this command is maintenance_part_add. Rigel runs this on its own, then says what it did. The agent guide has the rest.