Change what a comment says
tasks.comment.edit
POST/api/v1/households/{household_id}/commands/tasks.comment.edit
- Command
- Rigel runs it
- Applies offline
Rewrites a comment. Only its author can: a person their own, Rigel its own. Newly mentioned people are notified. Fails with comment_not_found or not_comment_author.
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 |
|---|---|
comment_idstringrequired | A task comment ID, such as tcm_01JC0000000000000000000000. |
bodystringrequired | The comment, in Markdown, as written, up to 10,000 characters. Mention people as @ and their name ("@Ada which color?"); they are notified. |
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 | comment_not_found | A comment that isn't there. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | not_comment_author |
|
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.
The author rewrites the text; the same mentions change nothing else
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "@Ben which color?"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "@Ben which color?",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "@Ben which color?"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0QSAJD4FZSPFVHKY8
{
"result": {},
"version": 1
}A new mention: they watch and are notified
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Which color, @Ben?"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "Which color, @Ben?",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Which color, @Ben?"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0P2KGPAB9EG53RGZY
{
"result": {},
"version": 1
}A dropped mention is removed and nobody is notified
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Color?"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "Color?",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Color?"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0PPPDZ472X8YGR7T8
{
"result": {},
"version": 1
}Swapping one mention for another
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "@Nia color?"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "@Nia color?",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "@Nia color?"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R01CZ8CHKSJPF2NF4Y
{
"result": {},
"version": 1
}Someone else's comment
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "Changed",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R08GJVGT8F092HBG8C
{
"error": {
"code": "not_comment_author",
"message": "Only the person who wrote a comment can change it. No changes were applied.",
"details": {
"comment_id": "tcm_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R08GJVGT8F092HBG8C"
}
}A person can't change Rigel's comment
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "Changed",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0NT2WRQA5C3WY2401
{
"error": {
"code": "not_comment_author",
"message": "Only the person who wrote a comment can change it. No changes were applied.",
"details": {
"comment_id": "tcm_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0NT2WRQA5C3WY2401"
}
}Someone with no person can't change a person's comment
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "Changed",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0RY7HR5DXN7Z5D5PM
{
"error": {
"code": "not_comment_author",
"message": "Only the person who wrote a comment can change it. No changes were applied.",
"details": {
"comment_id": "tcm_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0RY7HR5DXN7Z5D5PM"
}
}A comment that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01JC0000000000000000000001",
body: "Changed",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"comment_id": "tcm_01JC0000000000000000000001",
"body": "Changed"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0B7YRP35RH1VHB69J
{
"error": {
"code": "comment_not_found",
"message": "That comment isn't there any more. No changes were applied.",
"details": {
"comment_id": "tcm_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0B7YRP35RH1VHB69J"
}
}Change a comment
Only its author can. People it newly mentions are notified.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.comment.edit' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CT4FZCM48Y2E24SJC0Z3' \
-d '{
"comment_id": "tcm_01M6V9CT4814NB9500SCWV3MXS",
"body": "Oak. @Ben Okafor, the carpenter can hold the quote until Friday."
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.comment.edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CT4FZCM48Y2E24SJC0Z3",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
comment_id: "tcm_01M6V9CT4814NB9500SCWV3MXS",
body: "Oak. @Ben Okafor, the carpenter can hold the quote until Friday.",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.comment.edit HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT4FZCM48Y2E24SJC0Z3
{
"comment_id": "tcm_01M6V9CT4814NB9500SCWV3MXS",
"body": "Oak. @Ben Okafor, the carpenter can hold the quote until Friday."
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CT4F57ARD9YWWHWX5RTA
{
"result": {},
"version": 252
}For Rigel#
Rigel's tool for this command is tasks_comment_edit. Rigel runs this on its own, then says what it did. The agent guide has the rest.