Move a folder
documents.folder.move
POST/api/v1/households/{household_id}/commands/documents.folder.move
- Command
- Rigel runs it
- Applies offline
Moves a folder, with everything in it, into another folder or to the top level. Refused with folder_cycle when the new place is the folder itself or inside it, and with name_taken when the new place has a folder of the same name.
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 |
|---|---|
folder_idstringrequired | A folder ID, such as fld_01JC0000000000000000000000. |
parent_folder_idstring or nullrequired | The folder to move it into, or null for the top level. |
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 | folder_not_found |
|
404 | not_found | The household doesn't exist, or you aren't a member of it. |
409 | folder_cycle |
|
409 | name_taken | Where a folder has the same name. |
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.
Into another folder
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000003",
"parent_folder_id": "fld_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000003",
parent_folder_id: "fld_01JC0000000000000000000001",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000003",
"parent_folder_id": "fld_01JC0000000000000000000001"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0QRJKKX16ZFJ6SX8R
{
"result": {},
"version": 1
}To the top level
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000002",
"parent_folder_id": null
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000002",
parent_folder_id: null,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000002",
"parent_folder_id": null
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0T4AADKZRHHQZHB2N
{
"result": {},
"version": 1
}Into itself
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000001",
parent_folder_id: "fld_01JC0000000000000000000001",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000001"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0YH26D49XHHWE23WA
{
"error": {
"code": "folder_cycle",
"message": "A folder can't be moved into itself or into a folder inside it. No changes were applied.",
"details": {
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0YH26D49XHHWE23WA"
}
}Into a folder inside it
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000002"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000001",
parent_folder_id: "fld_01JC0000000000000000000002",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000002"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0462WSWTV6FGYKCYK
{
"error": {
"code": "folder_cycle",
"message": "A folder can't be moved into itself or into a folder inside it. No changes were applied.",
"details": {
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000002"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0462WSWTV6FGYKCYK"
}
}Where a folder has the same name
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000003",
"parent_folder_id": "fld_01JC0000000000000000000001"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000003",
parent_folder_id: "fld_01JC0000000000000000000001",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000003",
"parent_folder_id": "fld_01JC0000000000000000000001"
}HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0ZGY64F1WJD9FBZA1
{
"error": {
"code": "name_taken",
"message": "There is already a folder named \"cars\" there. No changes were applied.",
"details": {
"name": "cars"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R0ZGY64F1WJD9FBZA1"
}
}Into a folder that is gone
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000003"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000001",
parent_folder_id: "fld_01JC0000000000000000000003",
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": "fld_01JC0000000000000000000003"
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R036M3EQ0XJMHA5E97
{
"error": {
"code": "folder_not_found",
"message": "That folder isn't there any more. No changes were applied.",
"details": {
"folder_id": "fld_01JC0000000000000000000003"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R036M3EQ0XJMHA5E97"
}
}A folder that is gone
curl -X POST 'https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA' \
-d '{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": null
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01JC4N0000AAAAAAAAAAAAAAAA",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01JC0000000000000000000001",
parent_folder_id: null,
}),
});
const data = await response.json();POST /api/v1/households/hh_01K9BKKP003AHRZ6DMV29GQY5C/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01JC4N0000AAAAAAAAAAAAAAAA
{
"folder_id": "fld_01JC0000000000000000000001",
"parent_folder_id": null
}HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-Id: req_01K9D9S2R03RQV5953YXT0B6JR
{
"error": {
"code": "folder_not_found",
"message": "That folder isn't there any more. No changes were applied.",
"details": {
"folder_id": "fld_01JC0000000000000000000001"
},
"recovery": "Read the current state, then send a command that fits it.",
"request_id": "req_01K9D9S2R03RQV5953YXT0B6JR"
}
}Move a folder to the top level
parent_folder_id null makes it top-level.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CT9ZRANN8AB45PANF23K' \
-d '{
"folder_id": "fld_01M6V9CT9WX6XJG5K82AEN92ZD",
"parent_folder_id": null
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CT9ZRANN8AB45PANF23K",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01M6V9CT9WX6XJG5K82AEN92ZD",
parent_folder_id: null,
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CT9ZRANN8AB45PANF23K
{
"folder_id": "fld_01M6V9CT9WX6XJG5K82AEN92ZD",
"parent_folder_id": null
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CT9Z465V8VJ36168A39B
{
"result": {},
"version": 296
}Move a folder into another
Everything in it goes along.
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/documents.folder.move' \
-H "Cookie: rigel_session=$RIGEL_SESSION" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: cmd_01M6V9CTA0HHWWF7A93XPE5KWB' \
-d '{
"folder_id": "fld_01M6V9CT9WX6XJG5K82AEN92ZD",
"parent_folder_id": "fld_01M6V9CT9VW92QWV5HRBAXVASH"
}'const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/documents.folder.move", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Idempotency-Key": "cmd_01M6V9CTA0HHWWF7A93XPE5KWB",
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
body: JSON.stringify({
folder_id: "fld_01M6V9CT9WX6XJG5K82AEN92ZD",
parent_folder_id: "fld_01M6V9CT9VW92QWV5HRBAXVASH",
}),
});
const data = await response.json();POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/commands/documents.folder.move HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json
Idempotency-Key: cmd_01M6V9CTA0HHWWF7A93XPE5KWB
{
"folder_id": "fld_01M6V9CT9WX6XJG5K82AEN92ZD",
"parent_folder_id": "fld_01M6V9CT9VW92QWV5HRBAXVASH"
}HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CTA0TYMKV2MZMSKCHGAY
{
"result": {},
"version": 297
}For Rigel#
Rigel's tool for this command is documents_folder_move. Rigel runs this on its own, then says what it did. The agent guide has the rest.