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#
| 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 |
|---|---|
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). |
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). |
is_busy_onlybooleanoptional | Import only the times, as 'Busy', with no details. Forces direction import. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
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.
| 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 | integration_not_found |
|
404 | google_calendar_not_found |
|
404 | calendar_not_found |
|
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | already_linked |
|
409 | google_calendar_read_only | A read-only Google calendar can't be exported to. |
409 | calendar_not_busy_only | Busy-only can't be set on a calendar that has details. |
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.
A new calendar is made, named after the Google calendar, in the next free color
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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
}'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();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
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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"
}'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();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"
}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
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
}'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();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
}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.