Server-API: enrollment tokens
Als Markdown kopierenDiese Routen liegen auf der Server-API, Port 21114 (21121 in Docker). Sie nehmen einen API-Schlüssel in X-API-Key oder ein Anmelde-Token; siehe Die HTTP-API. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.
Tokens a device joins the server with, for one computer or for a rollout to many.
List enrollment tokens.
Without the tokens themselves.
On the server API, port 21114. Only for the role admin.
| Parameter | In | Type | What it is |
|---|---|---|---|
include_revoked |
query | boolean | Also list revoked tokens; default false |
200: Done (application/json)
| Field | Type | What it is |
|---|---|---|
tokens |
array of EnrollmentToken or null | null when there is none |
count |
integer |
| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 500 | Internal server error |
Make an enrollment token.
The answer holds the token itself, the only time it is shown. A rollout token lets many computers join and needs max_uses and expires_in_seconds.
On the server API, port 21114. Only for the role admin.
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
name |
string | |
kind |
string, one of device, rollout |
default "device" |
max_uses |
integer | 0 is no limit; a rollout token needs 1 to 100000; default 0, at least 0 |
expires_in_seconds |
integer | Seconds until it expires, 0 for never; a rollout token needs 1 to 31536000; default 0, at least 0 |
note |
string | |
folder_id |
integer | Put devices that join with it into this folder; 0 for none; at least 0 |
org_id |
string | Put devices that join with it into this organization |
201: Created (application/json)
| Error | When |
|---|---|
| 400 | Invalid JSON, a negative max_uses, an unknown kind, rollout limits, or a folder or organization that does not exist |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 500 | Internal server error |
| 503 | The folders cannot be read |
Make several enrollment tokens at once.
The tokens are named name_prefix-1, name_prefix-2 and so on. The answer holds the tokens themselves, the only time they are shown.
On the server API, port 21114. Only for the role admin.
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 | Uses per token; 0 means 1; default 1, at least 0 |
|
expires_in_seconds |
integer | Seconds until they expire, 0 for never; default 0, at least 0 |
|
folder_id |
integer | Put devices that join with them into this folder; 0 for none; at least 0 | |
org_id |
string | Put devices that join with them into this organization |
201: Created (application/json)
| Field | Type |
|---|---|
tokens |
array of EnrollmentToken |
count |
integer |
| Error | When |
|---|---|
| 400 | Invalid JSON, a count outside 1 to 100, a negative max_uses, or a folder or organization that does not exist |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 500 | Internal server error |
| 503 | The folders cannot be read |
Show an enrollment token.
On the server API, port 21114. Only for the role admin.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The token ID (see GET /api/tokens) |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | Invalid token ID |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | Token not found |
Change an enrollment token.
A field the body leaves out keeps its value. An empty name keeps the name; a note of "" clears the note, max_uses 0 lifts the limit, folder_id 0 and org_id "" take the folder and the organization away. A rollout token keeps a limit of 1 to 100000.
On the server API, port 21114. Only for the role admin.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The token ID (see GET /api/tokens) |
Request body, application/json:
| Field | Type | What it is |
|---|---|---|
name |
string | |
max_uses |
integer | at least 0 |
note |
string | |
folder_id |
integer | at least 0 |
org_id |
string |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | Invalid JSON or token ID, a negative max_uses, or a folder or organization that does not exist |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | Token not found |
| 503 | The folders cannot be read |
Revoke an enrollment token.
The device bound to the token loses its credentials.
On the server API, port 21114. Only for the role admin.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The token ID (see GET /api/tokens) |
200: Done (application/json)
| Field | Type |
|---|---|
success |
true |
message |
string |
| Error | When |
|---|---|
| 400 | Invalid token ID |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | Token not found |
Bind an enrollment token to a device ID.
Only the device with this ID can then join with the token. A rollout token can't be bound.
On the server API, port 21114. Only for the role admin.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The token ID (see GET /api/tokens) |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
peer_id |
string | yes | The device ID, 6 to 16 characters; at least 6 characters, at most 16 characters |
200: Done (application/json)
| Field | Type |
|---|---|
success |
true |
message |
string |
token_id |
integer |
peer_id |
string |
| Error | When |
|---|---|
| 400 | Invalid JSON or token ID, or a missing or bad peer_id |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | Token not found |
| 409 | The token is revoked, a rollout token, or bound to a different device |