Search the docs
Menu
Updated Edit on GitHub

Console: transfers

Copy as Markdown

These routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.

File transfers between the console and devices.

POST /api/files/transfer

Start a file transfer to or from a device.

The device fetches or sends the file through its own routes. Errors other than the sign-in and permission checks are {"error": "..."}.

Needs device.connect. neodesk transfers start calls it.

Request body, application/json:

Field Type Required What it is
direction string, one of upload, download yes upload sends a file to the device, download fetches one from it
device_id string yes
filename string yes
sizeBytes integer In bytes; at least 0, at most 4294967296
mime_type string at most 255 characters

201: Started (application/json)

FileTransfer.

Error When
400 A field is missing or not valid, or the file is larger than 4 GB
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account lacks device.connect, or may not see the device (Access denied)
429 The device or the console has too many open transfers

GET /api/files/transfers

List file transfers.

Newest first, the transfers of the devices the account may see.

Needs device.connect. neodesk transfers list calls it.

Parameter In Type
device_id query string
status query string, one of pending, active, completed, failed, cancelled
direction query string, one of upload, download

200: Done (application/json)

Array of FileTransfer.

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

GET /api/files/transfers/{id}

Show how far a file transfer is.

Errors other than the sign-in and permission checks are {"error": "..."}.

Needs device.connect. neodesk transfers get calls it.

Parameter In Type Required What it is
id path string yes The transfer ID

200: Done (application/json)

Field Type What it is
transferredBytes integer
chunksReceived integer
direction string, one of upload, download
filename string
percent number transferredBytes of sizeBytes, 0 to 100
status string, one of pending, active, completed, failed, cancelled
totalBytes integer
totalChunks integer
transferId string
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 Transfer not found, also for a device the account may not see

POST /api/files/transfers/{id}/cancel

Cancel a file transfer.

Errors other than the sign-in and permission checks are {"error": "..."}.

Needs device.connect. neodesk transfers cancel calls it.

Parameter In Type Required What it is
id path string yes The transfer ID

200: Done (application/json)

Field Type Required
status "cancelled" yes
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 Transfer not found, or it can no longer be cancelled

GET /api/files/transfers/{id}/download

Download the file of a transfer.

Answers the file of a completed transfer as an attachment under its file name. Takes Range requests. Errors other than the sign-in and permission checks are {"error": "..."}.

Needs device.connect. neodesk transfers download calls it.

Parameter In Type Required What it is
id path string yes The transfer ID

200: The file, with the content type of its name (application/octet-stream)

String (binary).

206: Part of the file, for a Range request (application/octet-stream)

String (binary).

Error When
400 The transfer is not completed yet
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 Transfer not found, or its file is gone
412 A condition of the request failed (Download failed)
416 The range lies beyond the file (Download failed)

Type to search pages, sections, commands and settings.