# Konsole: cdap

Quelle: https://docs.neode.sk/de/development/api-reference/console-cdap/
Zuletzt geändert: 2026-12-03

> 10 Operationen. CDAP devices, their widgets and commands.

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als `Authorization: Bearer ndt_...`; siehe [API-Tokens](https://docs.neode.sk/de/command-line/api-tokens.md). Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

CDAP devices, their widgets and commands.

## GET /api/cdap/alerts

List CDAP alerts.

Lists the alerts that are firing now, without the success wrapper. Accounts outside the admin roles get only the alerts of devices they may see.

Needs `cdap.view`. `neodesk cdap alerts` calls it.

| Parameter | In | Type | What it is |
|---|---|---|---|
| `device_id` | query | string | Only the alerts of this device |

**200**: The firing alerts (`application/json`)

| Field | Type |
|---|---|
| `alerts` | array of [CdapAlert](https://docs.neode.sk/de/development/api-reference/schemas.md#cdapalert) |
| `total` | 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 |
| 503 | The CDAP gateway is off (the API server's answer) |

## GET /api/cdap/devices

List CDAP devices.

Lists the connected devices, without the success wrapper. Accounts outside the admin roles get only the devices they may see.

Needs `cdap.view`. `neodesk cdap list` calls it.

**200**: The connected devices (`application/json`)

| Field | Type |
|---|---|
| `devices` | array of [CdapDeviceInfo](https://docs.neode.sk/de/development/api-reference/schemas.md#cdapdeviceinfo) |
| `total` | 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 |
| 503 | The CDAP gateway is off (the API server's answer) |

## GET /api/cdap/devices/{id}

Show one CDAP device.

Answers the device with its manifest, widget values and connection, without the success wrapper. A device that is not connected but has a saved manifest comes with connected false.

Needs `cdap.view`. `neodesk cdap get` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The CDAP device ID |

**200**: The device (`application/json`)

[CdapDeviceInfo](https://docs.neode.sk/de/development/api-reference/schemas.md#cdapdeviceinfo).

| Error | When |
|---|---|
| 400 | The device ID is not valid (the API server's answer) |
| 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 | Not a CDAP device (the API server's answer) |
| 503 | The CDAP gateway is off (the API server's answer) |

## POST /api/cdap/devices/{id}/command

Send a command to a widget of a CDAP device.

Sends the command and answers once the gateway has passed it on, not when the device has carried it out. The widget's own permissions (viewer, operator or admin) decide which roles may send which action; a delegation can raise the account's role for the device. A command to a terminal widget runs in a shell on the device and also needs cdap.terminal.

Needs `cdap.command`. `neodesk cdap command` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The CDAP device ID |

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `widget_id` | string | yes | the widget's ID in the device's manifest |
| `action` | string, one of `set`, `trigger`, `execute`, `reset`, `query` | yes | what to do with the widget |
| `value` |  |  | the value for the widget as JSON, like true for a toggle or 50 for a slider |
| `reason` | string |  | why, sent to the device with the command; empty when left out |

**202**: The command went out to the device (`application/json`)

| Field | Type |
|---|---|
| `status` | `"sent"` |
| `command_id` | string |
| `device_id` | string |

| Error | When |
|---|---|
| 400 | widget_id or action is missing, or the action or device ID is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account may not send this action to the widget, lacks cdap.terminal for a terminal widget, or does not see the device. The API server's refusal names the role the widget asks for in required and the account's role in your_role. |
| 404 | The widget is not on the device (the API server's answer) |
| 502 | The device is not connected or the command failed (the API server's answer) |
| 503 | The CDAP gateway is off (the API server's answer) |

## POST /api/cdap/devices/{id}/link

Link a CDAP device to a desktop device (empty to unlink).

Sets linked_peer_id of the device on the API server. Answers without the success wrapper.

Needs `cdap.command`. `neodesk cdap link` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The CDAP device ID |

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `linked_peer_id` | string or null | yes | the desktop device to link; empty or null removes the link |

**200**: Linked (`application/json`)

| Field | Type |
|---|---|
| `status` | `"updated"` |
| `id` | string |

| Error | When |
|---|---|
| 400 | linked_peer_id is missing |
| 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/cdap/devices/{id}/linked

Show the desktop device a CDAP device is linked to.

Answers without the success wrapper. linked is null when no device is linked.

Needs `cdap.view`. `neodesk cdap linked` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The CDAP device ID |

**200**: The linked devices (`application/json`)

| Field | Type |
|---|---|
| `peer_id` | string |
| `linked` | array of [CdapLinkedPeer](https://docs.neode.sk/de/development/api-reference/schemas.md#cdaplinkedpeer) or null |
| `total` | 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 |

## GET /api/cdap/devices/{id}/manifest

Show a CDAP device's widgets.

Answers the device's manifest as it is, without the success wrapper.

Needs `cdap.view`. `neodesk cdap manifest` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The CDAP device ID |

**200**: The manifest (`application/json`)

[CdapManifest](https://docs.neode.sk/de/development/api-reference/schemas.md#cdapmanifest).

| Error | When |
|---|---|
| 400 | The device ID is not valid (the API server's answer) |
| 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 | The device has no manifest (the API server's answer) |
| 503 | The CDAP gateway is off (the API server's answer) |

## GET /api/cdap/devices/{id}/state

Show a CDAP device's widget values.

Answers without the success wrapper. Only a connected device has values.

Needs `cdap.view`. `neodesk cdap state` calls it.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The CDAP device ID |

**200**: The widget values (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `device_id` | string |  |
| `widget_state` | object | The current value of each widget, by widget ID |
| `connected` | `true` |  |

| Error | When |
|---|---|
| 400 | The device ID is not valid (the API server's answer) |
| 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 | The device is not connected (the API server's answer) |
| 503 | The CDAP gateway is off (the API server's answer) |

## GET /api/cdap/status

Show whether the CDAP gateway runs.

Answers the gateway state as the API server gives it, without the success wrapper.

Needs `cdap.view`. `neodesk cdap status` calls it.

**200**: The gateway state (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `enabled` | boolean |  |
| `connected` | integer | How many devices are connected |
| `port` | integer | The gateway port, 0 when it is off |
| `tls` | boolean | Whether the gateway port uses TLS; missing when the gateway is off |

| 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 |

## POST /api/cdap/toggle

Turn the CDAP gateway on or off (after a restart).

Saves the setting cdap_enabled, which the server reads at its next start, and adds the change to your restart transaction (restartRequired), so a cancel of the restart puts the old value back. The answer has no data wrapper.

Needs `server.config`. `neodesk cdap toggle` calls it.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `enabled` | boolean | yes | turn the gateway on (true) or off (false) |

**200**: Saved; the change waits for a restart (`application/json`)

| Field | Type | What it is |
|---|---|---|
| `success` | `true` |  |
| `enabled` | boolean |  |
| `restart_required` | `true` |  |
| `restartRequired` | object | Your restart transaction with this change in it |
| `restartRequired.id` | string |  |
| `restartRequired.phase` | string |  |
| `restartRequired.status` | string |  |
| `restartRequired.ready` | boolean |  |
| `restartRequired.failed` | boolean |  |
| `restartRequired.startedAt` | string or null (date-time) |  |
| `restartRequired.updatedAt` | string (date-time) |  |
| `restartRequired.changes` | array of object |  |
| `restartRequired.changes[].key` | string |  |
| `restartRequired.changes[].label` | string |  |
| `restartRequired.error` | string or null |  |

| 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 |
| 409 | Another operator has a restart transaction open |
| 500 | The setting could not be read or saved |
