Skip to content
Rigel docs
Open Rigel

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#

Move a folder: parameters
FieldDescription
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.

Move a folder: request body fields
FieldDescription
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.

Move a folder: response fields
FieldDescription
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.

Move a folder: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404folder_not_found
  • Into a folder that is gone.
  • A folder that is gone.
404not_foundThe household doesn't exist, or you aren't a member of it.
409folder_cycle
  • Into itself.
  • Into a folder inside it.
409name_takenWhere a folder has the same name.
409idempotency_key_reusedThe 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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0QRJKKX16ZFJ6SX8R

{
  "result": {},
  "version": 1
}

To the top level

Request, curl
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
}'
Request, TypeScript
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();
Request, HTTP
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
}
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01K9D9S2R0T4AADKZRHHQZHB2N

{
  "result": {},
  "version": 1
}

Into itself

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 409
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

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 404
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

Request, curl
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
}'
Request, TypeScript
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();
Request, HTTP
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
}
Response, 404
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.

Request, curl
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
}'
Request, TypeScript
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();
Request, HTTP
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
}
Response, 200
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.

Request, curl
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"
}'
Request, TypeScript
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();
Request, HTTP
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"
}
Response, 200
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.

Rigel is in early access, and sign-up is by invitation. Open Rigel