Skip to content
Rigel docs
Open Rigel

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#

Add a photo of an item: parameters
FieldDescription
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.

Add a photo of an item: request body fields
FieldDescription
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.

at most 500 characters
researchbooleanoptional

false to skip looking it up, for corrections Rigel's own research makes. Leave it out otherwise.

Response#

200 The command was applied.

Add a photo of an item: response fields
FieldDescription
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.

Add a photo of an item: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404file_not_found
  • The file doesn't exist in this household.
  • A file that isn't there.
404asset_not_foundAn item that isn't there.
404not_foundThe household doesn't exist, or you aren't a member of it.
409photo_already_added
  • That file is already on this item.
  • The same file on the same item.
409idempotency_key_reusedThe 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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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
}'
Request, TypeScript
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();
Request, HTTP
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
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 404
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 404
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.

Rigel is in early access, and sign-up is by invitation. Open Rigel