Console: device-files
Copy as MarkdownThese routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.
Files on a device with a NeoDesk agent.
List a folder on a device.
Asks the NeoDesk agent over its connection. Needs the file transfer client feature. When the agent is offline, the route answers the snapshot the server keeps, or 202 with a collection queued for when it comes back (only for an account with agent.files).
Needs agent.files. neodesk device-files list calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device ID |
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
path |
string | The folder; empty for the top level; at most 4096 characters |
show_hidden |
boolean | default false |
200: Done (application/json)
202: The agent is offline; a collection is queued (application/json)
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 502 | The agent answered with an error |
| 503 | The agent is not connected (agent_offline) |
| 504 | The agent did not answer in time (agent_timeout) |
Delete a file or folder on a device.
Asks the NeoDesk agent over its connection. Needs the file transfer client feature. Written to the audit log.
Needs agent.files. neodesk device-files delete calls it. It cannot be undone.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device ID |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
path |
string | yes | at most 4096 characters |
recursive |
boolean | true to delete a folder with what it holds; default false |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 502 | The agent answered with an error |
| 503 | The agent is not connected (agent_offline) |
| 504 | The agent did not answer in time (agent_timeout) |
Make a folder on a device.
Asks the NeoDesk agent over its connection. Needs the file transfer client feature. Written to the audit log.
Needs agent.files. neodesk device-files mkdir calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device ID |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
path |
string | yes | at most 4096 characters |
recursive |
boolean | Make the missing folders above it too; default true |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 502 | The agent answered with an error |
| 503 | The agent is not connected (agent_offline) |
| 504 | The agent did not answer in time (agent_timeout) |
Read a file on a device (up to 1 MB per call).
Asks the NeoDesk agent over its connection. Needs the file transfer client feature. When the agent is offline, a read is queued and the route answers 202.
Needs agent.files. neodesk device-files read calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device ID |
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
path |
string | at most 4096 characters |
offset |
integer | Where to start, in bytes; default 0, at least 0 |
length |
integer | How many bytes; default 65536, at least 0, at most 1048576 |
200: Done (application/json)
202: The agent is offline; a collection is queued (application/json)
| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 502 | The agent answered with an error |
| 503 | The agent is not connected (agent_offline) |
| 504 | The agent did not answer in time (agent_timeout) |
Rename or move a file on a device.
Asks the NeoDesk agent over its connection. Needs the file transfer client feature. Written to the audit log.
Needs agent.files. neodesk device-files rename calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device ID |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
from |
string | yes | at most 4096 characters |
to |
string | yes | at most 4096 characters |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 502 | The agent answered with an error |
| 503 | The agent is not connected (agent_offline) |
| 504 | The agent did not answer in time (agent_timeout) |
Write a file on a device.
Asks the NeoDesk agent over its connection. Needs the file transfer client feature. Written to the audit log.
Needs agent.files. neodesk device-files write calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device ID |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
path |
string | yes | at most 4096 characters |
data |
string | The content | |
mode |
string, one of overwrite, append, create |
default "overwrite" |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 413 | data is longer than 22 Mi characters |
| 502 | The agent answered with an error |
| 503 | The agent is not connected (agent_offline) |
| 504 | The agent did not answer in time (agent_timeout) |