Link an item to the right model
maintenance.asset.correct_model
POST/api/v1/households/{household_id}/commands/maintenance.asset.correct_model
- Command
- Rigel runs it
- Applies offline
Links the item to the model with exactly this manufacturer, model number and variant, made if the household has none yet, and marks the item identified (while Rigel is looking the item up, that waits until it finishes). Rigel then looks the model up online, unless research is false. This is also how a first model is set. It never edits the model the item had, which keeps its facts and parts for other items that share it. If category_key is given and the item is still "Not identified yet", it moves to that category.
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 |
|---|---|
asset_idstringrequired | A asset ID, such as ast_01JC0000000000000000000000. |
manufacturerstringoptional | The maker as printed on the label, such as Carrier. Case is kept. |
model_numberstringoptional | The complete model number exactly as printed, with every suffix and letter case. Never shorten it. |
variantstringoptional | A variant that changes compatibility or specs, such as 120V or left-hand. Leave it out when there isn't one. |
category_keystringoptional | A curated category key to move the item to when it is still unidentified, and to give a new model. |
researchbooleanoptional | false to skip looking it up, for corrections Rigel's own research makes. Leave it out otherwise. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
result.model_idstringrequired | The model the item now has. |
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 | 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 | unknown_category | A category key that isn't curated. |
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.
A first model is made, linked and the item moves out of unidentified
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B080M1714",
"category_key": "furnace"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
manufacturer: "Carrier",
model_number: "59TP6B080M1714",
category_key: "furnace",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B080M1714",
"category_key": "furnace"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0JXJPAP9NZYC2RDEN
{
"result": {
"model_id": "eqm_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Relinks to an existing model without touching either model
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
manufacturer: "Carrier",
model_number: "59TP6B",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0FQ3NDC05C0ATRNZ5
{
"result": {
"model_id": "eqm_01JC0000000000000000000002"
},
"version": 1
}An identified item's category stays even when a key is given
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "ST-1",
"category_key": "range"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
model_number: "ST-1",
category_key: "range",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "ST-1",
"category_key": "range"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R03771KNCPTMA6GM9E
{
"result": {
"model_id": "eqm_01JC4N0000VGW1STJ6TGXRB7FY"
},
"version": 1
}A new model takes the category of an already identified item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Lennox"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
manufacturer: "Lennox",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Lennox"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0G67EM3MCG1NTCV5Z
{
"result": {
"model_id": "eqm_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Unidentified stays when no key is given, and the new model has no category
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "X-1"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
model_number: "X-1",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "X-1"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0PYMD30YWVV0YPX45
{
"result": {
"model_id": "eqm_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Research: false links and identifies without looking it up
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B080M1714",
"category_key": "furnace",
"research": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
manufacturer: "Carrier",
model_number: "59TP6B080M1714",
category_key: "furnace",
research: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B080M1714",
"category_key": "furnace",
"research": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0WQDDJ5XRT3C749S7
{
"result": {
"model_id": "eqm_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}While researching, the status is left for the job to settle
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B080M1714",
"category_key": "furnace"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
manufacturer: "Carrier",
model_number: "59TP6B080M1714",
category_key: "furnace",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"manufacturer": "Carrier",
"model_number": "59TP6B080M1714",
"category_key": "furnace"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0SG3N00CK7WQ51AWK
{
"result": {
"model_id": "eqm_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}A category key that isn't curated
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "X",
"category_key": "spaceship"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
model_number: "X",
category_key: "spaceship",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "X",
"category_key": "spaceship"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0PB2AKEYGZABKGEAK
{
"error": {
"code": "unknown_category",
"message": "\"spaceship\" isn't a category Rigel knows. Pick a curated key or use category_name. No changes were applied.",
"details": {
"category_key": "spaceship"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0PB2AKEYGZABKGEAK"
}
}An item that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "X"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01JC0000000000000000000001",
model_number: "X",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"model_number": "X"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R03XR83JKJ5YYGTC64
{
"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_01K9D9S2R03XR83JKJ5YYGTC64"
}
}Link an item to the right model
Never edits the model the item had, which other items may share.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.asset.correct_model' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSVY3MSY1J9H5FKHZ7FA' \
-d '{
"asset_id": "ast_01M6V9CSVH77630WV0WA1X2DAK",
"manufacturer": "Hartwell",
"model_number": "HDW-3250",
"research": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.asset.correct_model", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSVY3MSY1J9H5FKHZ7FA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01M6V9CSVH77630WV0WA1X2DAK",
manufacturer: "Hartwell",
model_number: "HDW-3250",
research: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.asset.correct_model HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSVY3MSY1J9H5FKHZ7FA
{
"asset_id": "ast_01M6V9CSVH77630WV0WA1X2DAK",
"manufacturer": "Hartwell",
"model_number": "HDW-3250",
"research": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSVYM5K12M9JQZ9RHJR5
{
"result": {
"model_id": "eqm_01M6V9CSVYCP9NFV9882GFRJFN"
},
"version": 182
}For Rigel#
Rigel's tool for this command is maintenance_asset_correct_model. Rigel runs this on its own, then says what it did. The agent guide has the rest.