Skip to content
Rigel docs
Open Rigel

Add a named person at a contractor

maintenance.contact.add

POST/api/v1/households/{household_id}/commands/maintenance.contact.add

  • Command
  • Rigel runs it
  • Applies offline

Records someone to ask for at a contractor, with how to reach them. An email address is also linked to that address in Email, so their mail shows on the contractor's page.

Parameters#

Add a named person at a contractor: 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 named person at a contractor: request body fields
FieldDescription
contractor_idstringrequired

A contractor ID, such as ctr_01JC0000000000000000000000.

namestringrequired

A name as the household says it, 1–120 characters.

at most 120 characters
rolestringoptional

Their job there: office manager, technician.

at most 500 characters
phonestringoptional

A phone number as written.

at most 500 characters
emailstringoptional

An email address.

at most 500 characters
notesstringoptional

Anything worth remembering, such as the best time to call.

at most 20,000 characters

Response#

200 The command was applied.

Add a named person at a contractor: response fields
FieldDescription
resultobjectrequired

What the command returned, such as the IDs it created.

result.contact_idstringrequired

The new contact.

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 named person at a contractor: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404contractor_not_foundA contractor that isn't there.
404not_foundThe household doesn't exist, or you aren't a member of it.
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.

A named person

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "contractor_id": "ctr_01JC00000000000000000000K1",
  "name": "Pat",
  "role": "Dispatcher",
  "phone": "555-0101",
  "email": "pat@example.com",
  "notes": "Mornings"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    contractor_id: "ctr_01JC00000000000000000000K1",
    name: "Pat",
    role: "Dispatcher",
    phone: "555-0101",
    email: "pat@example.com",
    notes: "Mornings",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "contractor_id": "ctr_01JC00000000000000000000K1",
  "name": "Pat",
  "role": "Dispatcher",
  "phone": "555-0101",
  "email": "pat@example.com",
  "notes": "Mornings"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0B3VQDWEKY8HVY29N

{
  "result": {
    "contact_id": "ccn_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

Only a name

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "contractor_id": "ctr_01JC00000000000000000000K1",
  "name": "Pat"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    contractor_id: "ctr_01JC00000000000000000000K1",
    name: "Pat",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "contractor_id": "ctr_01JC00000000000000000000K1",
  "name": "Pat"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0A5T31AYRF0FHE88R

{
  "result": {
    "contact_id": "ccn_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

A contractor that isn't there

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "contractor_id": "ctr_01JC00000000000000000000K1",
  "name": "Pat"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    contractor_id: "ctr_01JC00000000000000000000K1",
    name: "Pat",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/maintenance.contact.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "contractor_id": "ctr_01JC00000000000000000000K1",
  "name": "Pat"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0642PAHMCYY8EZ5X0

{
  "error": {
    "code": "contractor_not_found",
    "message": "That contractor isn't there any more. No changes were applied.",
    "details": {
      "contractor_id": "ctr_01JC00000000000000000000K1"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0642PAHMCYY8EZ5X0"
  }
}

Add the person to ask for at a contractor

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contact.add' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01M6V9CSWG95YAASDWDM767PNE' \
  -d '{
  "contractor_id": "ctr_01M6V9CSWEFJH8CRZCXNAH8109",
  "name": "Pat Smith",
  "role": "Service manager",
  "notes": "Best reached before 10 am."
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contact.add", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01M6V9CSWG95YAASDWDM767PNE",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    contractor_id: "ctr_01M6V9CSWEFJH8CRZCXNAH8109",
    name: "Pat Smith",
    role: "Service manager",
    notes: "Best reached before 10 am.",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/maintenance.contact.add HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSWG95YAASDWDM767PNE

{
  "contractor_id": "ctr_01M6V9CSWEFJH8CRZCXNAH8109",
  "name": "Pat Smith",
  "role": "Service manager",
  "notes": "Best reached before 10 am."
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSWGVZTJGA85JRQYVX6D

{
  "result": {
    "contact_id": "ccn_01M6V9CSWGTX839J9HJDVKV38M"
  },
  "version": 192
}

For Rigel#

Rigel's tool for this command is maintenance_contact_add. 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