Console: device-tokens
Copy as MarkdownThese routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.
Tokens that let a new device join without approval.
List device tokens.
Revoked tokens only with include_revoked=true.
Needs enrollment.manage. neodesk device-tokens list calls it.
| Parameter | In | Type | What it is |
|---|---|---|---|
include_revoked |
query | string, one of true |
true to list revoked tokens too |
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
success |
true |
yes | |
data |
object | yes | |
data.tokens |
array of DeviceToken or null | null when there are none | |
data.count |
integer |
| 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 |
| 502 | The server API did not answer |
Make a device token (shown once).
The answer holds the token, the only time it is shown. The console passes the call on to the server API. A refusal comes back with the server's status and {"success": false, "error": reason}; a call that got no answer is 502. field_presets are the device field values every computer that joins with the token gets.
Needs enrollment.manage. neodesk device-tokens create calls it.
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
name |
string | |
kind |
string, one of device, rollout |
device for a token of one computer, rollout for one of many computers; default "device" |
max_uses |
integer | How many enrollments it allows; 0 for no limit. A rollout token needs 1 to 100000; at least 0 |
expires_in_seconds |
integer | Seconds until it expires; 0 for never. A rollout token needs 1 to 31536000 (a year); at least 0 |
note |
string | |
folder_id |
integer | The folder a device that enrolls with it goes to; 0 for none; at least 0 |
org_id |
string | The organization a device that enrolls with it goes to; empty for none |
field_presets |
object | Device field values every computer that joins with the token gets, by key, for fields without a value on it; null or "" takes a preset away, a key left out keeps its preset. Each key must be a field the account sees, a field of an organization only on a token of that organization; needs device.fields_edit (403 device_field_forbidden). Checked before the token is made or changed (400 device_field_<reason>). Writes device_field_presets_changed to the audit log. |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
DeviceToken | yes |
| Error | When |
|---|---|
| 400 | A field is not valid, or the folder does not exist |
| 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 |
| 502 | The server API did not answer |
Make several device tokens at once.
The tokens are named name_prefix-1, name_prefix-2 and so on. The answer holds the tokens, the only time they are shown. The console passes the call on to the server API. A refusal comes back with the server's status and {"success": false, "error": reason}; a call that got no answer is 502.
Needs enrollment.manage. neodesk device-tokens create-many calls it.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
count |
integer | yes | at least 1, at most 100 |
name_prefix |
string | default "Device" |
|
max_uses |
integer | Enrollments each allows; 0 counts as 1; default 1, at least 0 |
|
expires_in_seconds |
integer | Seconds until they expire; 0 for never; at least 0 | |
folder_id |
integer | The folder a device that enrolls with it goes to; 0 for none; at least 0 | |
org_id |
string | The organization a device that enrolls with it goes to; empty for none |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
object | yes |
data.tokens |
array of DeviceToken | |
data.count |
integer |
| Error | When |
|---|---|
| 400 | A field 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 |
| 502 | The server API did not answer |
Change a device token.
Give only what changes: an empty name keeps the name, a note of "" clears the note, max_uses 0 lifts the limit (a rollout token keeps one from 1 to 100000). The console passes the call on to the server API. A refusal comes back with the server's status and {"success": false, "error": reason}; a call that got no answer is 502. field_presets are the device field values every computer that joins with the token gets.
Needs enrollment.manage. neodesk device-tokens update calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device token ID |
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
name |
string | |
max_uses |
integer | at least 0 |
note |
string | |
folder_id |
integer | The folder a device that enrolls with it goes to; 0 for none; at least 0 |
org_id |
string | The organization a device that enrolls with it goes to; empty for none |
field_presets |
object | Device field values every computer that joins with the token gets, by key, for fields without a value on it; null or "" takes a preset away, a key left out keeps its preset. Each key must be a field the account sees, a field of an organization only on a token of that organization; needs device.fields_edit (403 device_field_forbidden). Checked before the token is made or changed (400 device_field_<reason>). Writes device_field_presets_changed to the audit log. |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
DeviceToken | yes |
| 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 server API did not answer |
Revoke a device token.
The console passes the call on to the server API. A refusal comes back with the server's status and {"success": false, "error": reason}; a call that got no answer is 502.
Needs enrollment.manage. neodesk device-tokens revoke calls it. It cannot be undone.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device token ID |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
object | yes |
data.success |
true |
|
data.message |
string |
| 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 server API did not answer |
Tie a device token to one device.
Only that device can enroll with it then. The console passes the call on to the server API. A refusal comes back with the server's status and {"success": false, "error": reason}; a call that got no answer is 502.
Needs enrollment.manage. neodesk device-tokens bind calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device token ID |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
peer_id |
string | yes | The device ID; at least 6 characters, at most 16 characters |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
object | yes |
data.message |
string | |
data.peer_id |
string | |
data.success |
boolean | |
data.token_id |
integer |
| 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 |
| 409 | The token is revoked, is a rollout token, or is tied to another device |
| 502 | The server API did not answer |
Show the device field values a device token presets.
Only presets of fields the account sees. A computer that joins with the token gets each preset for a field without a value on it; a field of an organization only from a token of that organization.
Needs enrollment.manage. neodesk device-tokens field-presets calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | string | yes | The device token ID |
200: The presets by key (application/json)
| Field | Type | Required |
|---|---|---|
success |
true |
yes |
data |
object | yes |
data.token_id |
integer | yes |
data.field_presets |
object | yes |
| 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 |
| 500 | Something failed on the server (the text of errors.server_error) |