Rename a tag
tasks.tag.rename
POST/api/v1/households/{household_id}/commands/tasks.tag.rename
- Command
- Rigel runs it
- Applies offline
Renames a tag everywhere it's used. Fails with tag_not_found, or name_taken when another tag already has the name ignoring case (move its tasks with tasks.task.set_tags, then remove one).
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 |
|---|---|
tag_idstringrequired | A tag ID, such as tag_01JC0000000000000000000000. |
namestringrequired | A tag's name, as written, 1–50 characters, without "#": "errands". Matched ignoring case. |
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 | tag_not_found | A tag that isn't there. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | name_taken | Another tag's name ignoring case. |
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.
Renames the tag
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"tag_id": "tag_01JC0000000000000000000001",
"name": "chores"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01JC0000000000000000000001",
name: "chores",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"tag_id": "tag_01JC0000000000000000000001",
"name": "chores"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0T1BMDJP6RW4B2M6H
{
"result": {},
"version": 1
}A different case of its own name is allowed
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"tag_id": "tag_01JC0000000000000000000001",
"name": "Errands"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01JC0000000000000000000001",
name: "Errands",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"tag_id": "tag_01JC0000000000000000000001",
"name": "Errands"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R06NKR19JZD0W4R3AC
{
"result": {},
"version": 1
}Its own name again writes nothing
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"tag_id": "tag_01JC0000000000000000000001",
"name": "errands"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01JC0000000000000000000001",
name: "errands",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"tag_id": "tag_01JC0000000000000000000001",
"name": "errands"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0SEKHDW8XWD011GNE
{
"result": {},
"version": 1
}Another tag's name ignoring case
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"tag_id": "tag_01JC0000000000000000000001",
"name": "outSIDE"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01JC0000000000000000000001",
name: "outSIDE",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"tag_id": "tag_01JC0000000000000000000001",
"name": "outSIDE"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0KS7PB4317KN3JD1Y
{
"error": {
"code": "name_taken",
"message": "Another tag already has that name. No changes were applied.",
"details": {
"tag_id": "tag_01JC0000000000000000000002"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0KS7PB4317KN3JD1Y"
}
}A tag that isn't there
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"tag_id": "tag_01JC0000000000000000000001",
"name": "chores"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01JC0000000000000000000001",
name: "chores",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"tag_id": "tag_01JC0000000000000000000001",
"name": "chores"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R09Z7R45RSKW4FC5C3
{
"error": {
"code": "tag_not_found",
"message": "That tag isn't there any more. No changes were applied.",
"details": {
"tag_id": "tag_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R09Z7R45RSKW4FC5C3"
}
}Rename a tag
It changes everywhere the tag is used.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CT6GP2R1R632MATKBBX9' \
-d '{
"tag_id": "tag_01M6V9CT2W0CCE5JSQRR9GSCT6",
"name": "yard"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CT6GP2R1R632MATKBBX9",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01M6V9CT2W0CCE5JSQRR9GSCT6",
name: "yard",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT6GP2R1R632MATKBBX9
{
"tag_id": "tag_01M6V9CT2W0CCE5JSQRR9GSCT6",
"name": "yard"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CT6GY932E3NMF9NT8V78
{
"result": {},
"version": 256
}Rename a tag to a name that's taken
Names are unique ignoring case. Move the tasks with tasks.task.set_tags, then remove one.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.tag.rename' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CT6JDREGP341YS14EVF7' \
-d '{
"tag_id": "tag_01M6V9CT2HYP2JXTPT7T98VN41",
"name": "Chores"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.tag.rename", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CT6JDREGP341YS14EVF7",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
tag_id: "tag_01M6V9CT2HYP2JXTPT7T98VN41",
name: "Chores",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/tasks.tag.rename HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT6JDREGP341YS14EVF7
{
"tag_id": "tag_01M6V9CT2HYP2JXTPT7T98VN41",
"name": "Chores"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01M6V9CT6JRC9SBF4V1B5AMRR3
{
"error": {
"code": "name_taken",
"message": "Another tag already has that name. No changes were applied.",
"details": {
"tag_id": "tag_01M6V9CT2QMBNSDQ82KK1PJ6AV"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01M6V9CT6JRC9SBF4V1B5AMRR3"
}
}For Rigel#
Rigel's tool for this command is tasks_tag_rename. Rigel runs this on its own, then says what it did. The agent guide has the rest.