Add a photo of an item
maintenance.asset.add_photo
POST/api/v1/households/{household_id}/commands/maintenance.asset.add_photo
- Command
- Rigel runs it
- Applies offline
Attaches a photo already uploaded to the household's files: the unit, its label, damage, or anything else. A label photo (or a unit photo on an item that isn't identified yet) makes Rigel look the item up, unless research is false. Errors: file_not_found, photo_already_added (that file is already on this item).
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. |
file_idstringrequired | The photo, already uploaded. |
roleone of: unit, label, damage, otherrequired | What the photo shows: unit (the equipment itself), label (its brand, model or rating sticker), damage (a problem), other. |
captionstringoptional | A few words about the photo. |
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.photo_idstringrequired | The new photo record. |
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 | file_not_found |
|
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 | photo_already_added |
|
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.
Adds a photo
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label",
"caption": "Rating plate"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "label",
caption: "Rating plate",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label",
"caption": "Rating plate"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YCVQQD52Q3EGEY88
{
"result": {
"photo_id": "aph_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}The same file on another item is fine
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "unit",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0J7FPEZ51F2RCQCJK
{
"result": {
"photo_id": "aph_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}Research: false adds the label photo and starts nothing
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label",
"research": false
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "label",
research: false,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label",
"research": false
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00MZC9KMS321TMA5T
{
"result": {
"photo_id": "aph_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}A unit photo on an identified item starts nothing
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "unit",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XEX9WYS8M1GTAXJ1
{
"result": {
"photo_id": "aph_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}A damage photo starts nothing
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "damage"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "damage",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "damage"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R030VSY7HK5KY2GRKF
{
"result": {
"photo_id": "aph_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}A label photo on a retired item starts nothing
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "label",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0ERM79H8M4NHV5VHY
{
"result": {
"photo_id": "aph_01JC4N0000MBGE5RJ6Q7V6V6T8"
},
"version": 1
}The same file on the same item
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "label",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "label"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0J1HNKAS23FYZYY66
{
"error": {
"code": "photo_already_added",
"message": "That photo is already on this item. No changes were applied.",
"details": {
"photo_id": "aph_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0J1HNKAS23FYZYY66"
}
}A file that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "unit",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0Q06G24VPFMES9C9Y
{
"error": {
"code": "file_not_found",
"message": "That file isn't there any more. No changes were applied.",
"details": {
"file_id": "fil_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0Q06G24VPFMES9C9Y"
}
}An item that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo", {
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",
file_id: "fil_01JC0000000000000000000001",
role: "unit",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.asset.add_photo HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"asset_id": "ast_01JC0000000000000000000001",
"file_id": "fil_01JC0000000000000000000001",
"role": "unit"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0G6MK59PAE2BBR9VQ
{
"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_01K9D9S2R0G6MK59PAE2BBR9VQ"
}
}For Rigel#
Rigel's tool for this command is maintenance_asset_add_photo. Rigel runs this on its own, then says what it did. The agent guide has the rest.