Delete an event
calendar.event.remove
POST/api/v1/households/{household_id}/commands/calendar.event.remove
- Command
- Rigel runs it
- Applies offline
Deletes the event, with all its occurrences, changes, attachments and reminders. To skip one occurrence of a repeating event use calendar.event.cancel_occurrence. Events another app owns are refused (event_owned_by_app). Errors: event_not_found, event_owned_by_app.
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 |
|---|---|
event_idstringrequired | A calendar event ID, such as evt_01JC0000000000000000000000. |
Response#
200 The command was applied.
| Field | Description |
|---|---|
resultobjectrequired | What the command returned, such as the IDs it created. |
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 | event_not_found |
|
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | event_owned_by_app | An event another app owns is refused, naming the app. |
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.
Deletes the event and withdraws every notification about it
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"event_id": "evt_01JC000000000000000000000B"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
event_id: "evt_01JC000000000000000000000B",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"event_id": "evt_01JC000000000000000000000B"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0JRZNHDWZ59YR9TS3
{
"result": {},
"version": 1
}A repeating event goes with its changes and extra dates
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"event_id": "evt_01JC000000000000000000000A"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
event_id: "evt_01JC000000000000000000000A",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"event_id": "evt_01JC000000000000000000000A"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0HN4R2W6C3G7GVMP2
{
"result": {},
"version": 1
}An event another app owns is refused, naming the app
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"event_id": "evt_01JC000000000000000000000D"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
event_id: "evt_01JC000000000000000000000D",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"event_id": "evt_01JC000000000000000000000D"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0NX1X3QGJ9QKQVBWZ
{
"error": {
"code": "event_owned_by_app",
"message": "Maintenance manages this event. Change it there. No changes were applied.",
"details": {
"app": "maintenance"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0NX1X3QGJ9QKQVBWZ"
}
}The event must exist
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"event_id": "evt_01JC000000000000000000000Z"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
event_id: "evt_01JC000000000000000000000Z",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/calendar.event.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"event_id": "evt_01JC000000000000000000000Z"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0FESCDBVDX90MQANS
{
"error": {
"code": "event_not_found",
"message": "That event isn't on the calendar any more. No changes were applied.",
"details": {
"event_id": "evt_01JC000000000000000000000Z"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0FESCDBVDX90MQANS"
}
}Delete an event
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/calendar.event.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSMEC7JQH1JH2EVJM5XY' \
-d '{
"event_id": "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/calendar.event.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSMEC7JQH1JH2EVJM5XY",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
event_id: "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/calendar.event.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSMEC7JQH1JH2EVJM5XY
{
"event_id": "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSME6SHE4N3HHXW3Q0NX
{
"result": {},
"version": 105
}Delete an event that's already gone
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/calendar.event.remove' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CSMGSQ3PR3TFTNWNDQXD' \
-d '{
"event_id": "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/calendar.event.remove", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CSMGSQ3PR3TFTNWNDQXD",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
event_id: "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/calendar.event.remove HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CSMGSQ3PR3TFTNWNDQXD
{
"event_id": "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01M6V9CSMGGN7KJ7N7T6W652W6
{
"error": {
"code": "event_not_found",
"message": "That event isn't on the calendar any more. No changes were applied.",
"details": {
"event_id": "evt_01M6V9CSJ8BBY7SAS3VQTA0FCZ"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01M6V9CSMGGN7KJ7N7T6W652W6"
}
}For Rigel#
Rigel's tool for this command is calendar_event_remove. Rigel runs this on its own, then says what it did. The agent guide has the rest.