Record an item's warranty
maintenance.warranty.add
POST/api/v1/households/{household_id}/commands/maintenance.warranty.add
- Command
- Rigel runs it
- Applies offline
Records coverage for an item; an item can have several. Errors: invalid_range (it ends before it starts).
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. |
providerstringoptional | Who provides the coverage, as written: "Carrier", "Home Depot protection plan". |
coveragestringoptional | What it covers and its limits. |
starts_onstring (date)optional | When coverage starts, YYYY-MM-DD. |
ends_onstring (date)optional | When coverage ends, YYYY-MM-DD. |
evidenceobjectoptional | Where the coverage was read: the warranty card, the receipt. |
evidence.file_idstringoptional | A photo, manual or invoice already uploaded to the household's files. |
evidence.urlstring (uri)optional | A web address. |
evidence.said_by_person_idstringoptional | Who said it, when the source is something a person said. |
evidence.locatorstringoptional | Where in the source: "p. 14", "rating plate". |
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.warranty_idstringrequired | The new warranty. |
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 | invalid_range |
|
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 coverage with evidence (file present)
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"provider": "Carrier",
"coverage": "Parts for 10 years",
"starts_on": "2019-06-15",
"ends_on": "2029-06-15",
"evidence": {
"file_id": "fil_01JC0000000000000000000001"
}
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add", {
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",
provider: "Carrier",
coverage: "Parts for 10 years",
starts_on: "2019-06-15",
ends_on: "2029-06-15",
evidence: {
file_id: "fil_01JC0000000000000000000001",
},
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"provider": "Carrier",
"coverage": "Parts for 10 years",
"starts_on": "2019-06-15",
"ends_on": "2029-06-15",
"evidence": {
"file_id": "fil_01JC0000000000000000000001"
}
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0FCHYWGMTGMFT3GV3
{
"result": {
"warranty_id": "wty_01JC4N0000VGW1STJ6TGXRB7FY"
},
"version": 1
}An item can have several; nothing but the asset is needed
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add", {
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",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0SY70K27Y79EPPWCJ
{
"result": {
"warranty_id": "wty_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}A one-day warranty is allowed
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"starts_on": "2025-01-01",
"ends_on": "2025-01-01"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add", {
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",
starts_on: "2025-01-01",
ends_on: "2025-01-01",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"starts_on": "2025-01-01",
"ends_on": "2025-01-01"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0NRT0MYGTT8VSHH3M
{
"result": {
"warranty_id": "wty_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Ends before it starts
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"starts_on": "2025-01-02",
"ends_on": "2025-01-01"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add", {
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",
starts_on: "2025-01-02",
ends_on: "2025-01-01",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"starts_on": "2025-01-02",
"ends_on": "2025-01-01"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0640138N0C6YXDWQP
{
"error": {
"code": "invalid_range",
"message": "The coverage can't end before it starts. No changes were applied.",
"details": {
"starts_on": "2025-01-02",
"ends_on": "2025-01-01"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0640138N0C6YXDWQP"
}
}An item that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add", {
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",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.warranty.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R01WJW4VY9GVJSHKDM
{
"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_01K9D9S2R01WJW4VY9GVJSHKDM"
}
}Record an item's warranty
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.warranty.add' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSWB96BGFRQ05AVKF8D6' \
-d '{
"asset_id": "ast_01M6V9CSVH77630WV0WA1X2DAK",
"provider": "Hartwell",
"coverage": "Parts and labor for 2 years; the wash motor for 5 years.",
"starts_on": "2026-03-22",
"ends_on": "2031-03-21"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.warranty.add", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSWB96BGFRQ05AVKF8D6",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
asset_id: "ast_01M6V9CSVH77630WV0WA1X2DAK",
provider: "Hartwell",
coverage: "Parts and labor for 2 years; the wash motor for 5 years.",
starts_on: "2026-03-22",
ends_on: "2031-03-21",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.warranty.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSWB96BGFRQ05AVKF8D6
{
"asset_id": "ast_01M6V9CSVH77630WV0WA1X2DAK",
"provider": "Hartwell",
"coverage": "Parts and labor for 2 years; the wash motor for 5 years.",
"starts_on": "2026-03-22",
"ends_on": "2031-03-21"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSWBFZA00WPX3NVDTWXG
{
"result": {
"warranty_id": "wty_01M6V9CSWBMQER80DQ5KEZS608"
},
"version": 189
}For Rigel#
Rigel's tool for this command is maintenance_warranty_add. Rigel runs this on its own, then says what it did. The agent guide has the rest.