Files
Files under the configured roots, as the agent.
| Operation | Kind | HTTP |
|---|---|---|
files.read | call | GET /v1/files |
files.write | call | PUT /v1/files |
files.delete | call | DELETE /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
| Name | Where | Required | Description |
|---|---|---|---|
path | query | yes | An absolute path under a root. |
Result
Bytes: {"base64": …, "content_type": …} on the portal, the response body over HTTP (application/octet-stream).
{
"id": 1,
"op": "files.read",
"args": {
"path": "/srv/agent/workspaces/notes.txt"
}
}{
"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
| Name | Where | Required | Description |
|---|---|---|---|
path | query | yes | An absolute path under a root. |
overwrite | query | no | true to replace an existing file. |
Input
Bytes: {"base64": …} on the portal, the request body over HTTP.
Result
| Field | Type | Description |
|---|---|---|
ok | boolean |
{
"id": 1,
"op": "files.write",
"args": {
"path": "/srv/agent/workspaces/notes.txt"
},
"data": {
"base64": "aGVsbG8K"
}
}{
"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
| Name | Where | Required | Description |
|---|---|---|---|
path | query | yes | An absolute path under a root. |
recursive | query | no | true for a folder with its contents. |
Result
| Field | Type | Description |
|---|---|---|
ok | boolean |
{
"id": 1,
"op": "files.delete",
"args": {
"path": "/srv/agent/workspaces/notes.txt"
}
}{
"id": 1,
"result": {
"ok": true
}
}