Skip to content
Rigel docs
Open Rigel

Link a calendar to a Google calendar

calendar.google.link

POST/api/v1/households/{household_id}/commands/calendar.google.link

  • Command
  • Rigel runs it
  • Applies offline

Keeps one of the household's calendars in step with one calendar on a connected Google account. Give calendar_id to link an existing calendar, or leave it out to make a new calendar named after the Google calendar (a main calendar Google names by its address is named after the person who connected it; ' (Google)' is added if that name is taken) in the next free color. direction is both (the default), import (Google into Rigel only) or export (Rigel into Google only). A read-only Google calendar can only be import. is_busy_only imports only the times, as 'Busy': it forces import, and on an existing calendar it is accepted only if that calendar is already busy-only (a calendar's events are never rewritten as busy). Linking a busy-only calendar always imports. Rigel then pulls the whole Google calendar within moments. Errors: integration_not_found, google_calendar_not_found, calendar_not_found, already_linked, google_calendar_read_only, calendar_not_busy_only.

Parameters#

Link a calendar to a Google calendar: 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.

Link a calendar to a Google calendar: request body fields
FieldDescription
integration_idstringrequired

The connected Google account (an integration with service google_calendar).

google_calendar_idstringrequired

Google's ID for the calendar, from the account's calendars (household.google_calendar rows).

1 to 1,024 characters
calendar_idstringoptional

An existing Rigel calendar to link. Leave out to make a new one.

directionone of: both, import, exportoptional

both, import (Google into Rigel only) or export (Rigel into Google only).

Default "both"
is_busy_onlybooleanoptional

Import only the times, as 'Busy', with no details. Forces direction import.

Response#

200 The command was applied.

Link a calendar to a Google calendar: response fields
FieldDescription
resultobjectrequired

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

result.link_idstringrequired

The new link.

result.calendar_idstringrequired

The linked calendar: the one given, or the new one.

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.

Link a calendar to a Google calendar: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404integration_not_found
  • The integration doesn't exist in this household.
  • No such integration.
  • An integration for another service is not a Google calendar account.
404google_calendar_not_found
  • The google calendar doesn't exist in this household.
  • The Google calendar isn't in the account.
404calendar_not_found
  • The calendar doesn't exist in this household.
  • The calendar doesn't exist.
404not_foundThe household doesn't exist, or you aren't a member of it.
409already_linked
  • A calendar that already has a link.
  • A Google calendar that is already linked.
409google_calendar_read_onlyA read-only Google calendar can't be exported to.
409calendar_not_busy_onlyBusy-only can't be set on a calendar that has details.
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 new calendar is made, named after the Google calendar, in the next free color

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "both"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    direction: "both",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "both"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0D35VXQM631AW9SK9

{
  "result": {
    "link_id": "gcl_01JC4N0000VGW1STJ6TGXRB7FY",
    "calendar_id": "cal_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

The direction defaults to both

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YN40256KJF7H9DM9

{
  "result": {
    "link_id": "gcl_01JC4N0000VGW1STJ6TGXRB7FY",
    "calendar_id": "cal_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

A taken name (ignoring case) gets (Google) added

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0TDY05DT74H1MJ2VR

{
  "result": {
    "link_id": "gcl_01JC4N0000VGW1STJ6TGXRB7FY",
    "calendar_id": "cal_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

An existing calendar can be linked import-only

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000B",
  "direction": "import"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    calendar_id: "cal_01JC000000000000000000000B",
    direction: "import",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000B",
  "direction": "import"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R06AVT29E05KV172Q0

{
  "result": {
    "link_id": "gcl_01JC4N0000MBGE5RJ6Q7V6V6T8",
    "calendar_id": "cal_01JC000000000000000000000B"
  },
  "version": 1
}

Busy-only makes a new busy-only calendar and forces import

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "both",
  "is_busy_only": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    direction: "both",
    is_busy_only: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "both",
  "is_busy_only": true
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00CQF34KHNTE03JWX

{
  "result": {
    "link_id": "gcl_01JC4N0000VGW1STJ6TGXRB7FY",
    "calendar_id": "cal_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

A busy-only calendar always imports

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000B",
  "direction": "export"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    calendar_id: "cal_01JC000000000000000000000B",
    direction: "export",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000B",
  "direction": "export"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R019QGR4X1Y1S72W9D

{
  "result": {
    "link_id": "gcl_01JC4N0000MBGE5RJ6Q7V6V6T8",
    "calendar_id": "cal_01JC000000000000000000000B"
  },
  "version": 1
}

A read-only Google calendar can be imported

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "import"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    direction: "import",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "import"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0FJ7EGG3YWNAF093C

{
  "result": {
    "link_id": "gcl_01JC4N0000VGW1STJ6TGXRB7FY",
    "calendar_id": "cal_01JC4N0000MBGE5RJ6Q7V6V6T8"
  },
  "version": 1
}

A read-only Google calendar can't be exported to

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "both"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    direction: "both",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "direction": "both"
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0PTK5D5R2B7T518CR

{
  "error": {
    "code": "google_calendar_read_only",
    "message": "You can only read that Google calendar, so it can only be imported. No changes were applied.",
    "details": {
      "access_role": "reader"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0PTK5D5R2B7T518CR"
  }
}

No such integration

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000B",
  "google_calendar_id": "ben.okafor@example.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000B",
    google_calendar_id: "ben.okafor@example.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000B",
  "google_calendar_id": "ben.okafor@example.com"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0EHBJD5S97PCPVDTM

{
  "error": {
    "code": "integration_not_found",
    "message": "That Google account isn't connected any more. No changes were applied.",
    "details": {
      "integration_id": "int_01JC000000000000000000000B"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0EHBJD5S97PCPVDTM"
  }
}

An integration for another service is not a Google calendar account

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YQZ58DN16Z1NMQPM

{
  "error": {
    "code": "integration_not_found",
    "message": "That Google account isn't connected any more. No changes were applied.",
    "details": {
      "integration_id": "int_01JC000000000000000000000A"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0YQZ58DN16Z1NMQPM"
  }
}

The Google calendar isn't in the account

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "nobody@gmail.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "nobody@gmail.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "nobody@gmail.com"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R00A8M0WY2RR0V5HYC

{
  "error": {
    "code": "google_calendar_not_found",
    "message": "That calendar isn't in the Google account. No changes were applied.",
    "details": {
      "google_calendar_id": "nobody@gmail.com"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R00A8M0WY2RR0V5HYC"
  }
}

The calendar doesn't exist

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000B"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    calendar_id: "cal_01JC000000000000000000000B",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000B"
}
Response, 404
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R06AYER9XHWW05SP45

{
  "error": {
    "code": "calendar_not_found",
    "message": "That calendar isn't there any more. No changes were applied.",
    "details": {
      "calendar_id": "cal_01JC000000000000000000000B"
    },
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R06AYER9XHWW05SP45"
  }
}

A calendar that already has a link

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "work@gmail.com",
  "calendar_id": "cal_01JC000000000000000000000A"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "work@gmail.com",
    calendar_id: "cal_01JC000000000000000000000A",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "work@gmail.com",
  "calendar_id": "cal_01JC000000000000000000000A"
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0XB359C2RBKDBWBAX

{
  "error": {
    "code": "already_linked",
    "message": "That calendar or that Google calendar is already linked. No changes were applied.",
    "details": {},
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0XB359C2RBKDBWBAX"
  }
}

A Google calendar that is already linked

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com"
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0VVP2AFX3PAJRXGS9

{
  "error": {
    "code": "already_linked",
    "message": "That calendar or that Google calendar is already linked. No changes were applied.",
    "details": {},
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0VVP2AFX3PAJRXGS9"
  }
}

Busy-only can't be set on a calendar that has details

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
  -d '{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000A",
  "is_busy_only": true
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    integration_id: "int_01JC000000000000000000000A",
    google_calendar_id: "ben.okafor@example.com",
    calendar_id: "cal_01JC000000000000000000000A",
    is_busy_only: true,
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.google.link HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA

{
  "integration_id": "int_01JC000000000000000000000A",
  "google_calendar_id": "ben.okafor@example.com",
  "calendar_id": "cal_01JC000000000000000000000A",
  "is_busy_only": true
}
Response, 409
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0PEJ9QG47STGNK59K

{
  "error": {
    "code": "calendar_not_busy_only",
    "message": "Only a new calendar, or one that is already busy-only, can import just the times. No changes were applied.",
    "details": {},
    "recovery": "Read the current state, then send a command that fits it.",
    "request_id": "req_01K9D9S2R0PEJ9QG47STGNK59K"
  }
}

For Rigel#

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