Skip to Content

Files

Files under the configured roots, as the agent.

OperationKindHTTP
files.readcallGET /v1/files
files.writecallPUT /v1/files
files.deletecallDELETE /v1/files

files.read

A folder's entries (a Listing), or a file's content; Range is honoured. As the agent, under the configured roots.

Host level only. Through rookery serve it needs the role operate.

Arguments

NameWhereRequiredDescription
pathqueryyesAn absolute path under a root.

Result

Bytes: {"base64": …, "content_type": …} on the portal, the response body over HTTP (application/octet-stream).

Request
{
  "id": 1,
  "op": "files.read",
  "args": {
    "path": "/srv/agent/workspaces/notes.txt"
  }
}
Reply
{
  "id": 1,
  "result": {
    "base64": "aGVsbG8K",
    "content_type": "application/octet-stream"
  }
}

files.write

Write one file, creating its folders.

Host level only. Through rookery serve it needs the role operate.

Arguments

NameWhereRequiredDescription
pathqueryyesAn absolute path under a root.
overwritequerynotrue to replace an existing file.

Input

Bytes: {"base64": …} on the portal, the request body over HTTP.

Result

FieldTypeDescription
okboolean
Request
{
  "id": 1,
  "op": "files.write",
  "args": {
    "path": "/srv/agent/workspaces/notes.txt"
  },
  "data": {
    "base64": "aGVsbG8K"
  }
}
Reply
{
  "id": 1,
  "result": {
    "ok": true
  }
}

files.delete

Remove a file or an empty folder; never a root itself.

Host level only. Through rookery serve it needs the role operate.

Arguments

NameWhereRequiredDescription
pathqueryyesAn absolute path under a root.
recursivequerynotrue for a folder with its contents.

Result

FieldTypeDescription
okboolean
Request
{
  "id": 1,
  "op": "files.delete",
  "args": {
    "path": "/srv/agent/workspaces/notes.txt"
  }
}
Reply
{
  "id": 1,
  "result": {
    "ok": true
  }
}

On this page