Create device
| Method | Path |
|---|---|
POST | /v1/slim/device |
Authentication · Access policies
Creates a device in your project and, optionally, assigns it to a zone, a location and a resident in the same write.
Auth: bearer token. The caller must be a practitioner, an admin or a System Owner, and needs Device:create.
Scope: the device is created in the caller's project (from the token).
Behaviour
nameis stored as the device's user-friendly name and as its official device identifier.thingsboardIdis stored as a second identifier. When you omit it, Ovok generates a random UUID for it.organizationId,locationIdandpatientIdare optional. Each one you send is assigned in the same transaction as the create. If any part fails, nothing is written.- Assigning a resident moves them: the resident is removed from every other device they hold, and their active out-of-bed episode is closed.
- The device starts with status
active. - The create is recorded in the change history.
- The response is the same as
GET /v1/slim/device/{id}for the new device.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/slim/device' \
-H "Authorization: Bearer ${OVOK_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{"name": "Sleepiz/3001000", "locationId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21"}'
Successful response
201 — The created device.
Errors
| Status | Meaning |
|---|---|
401 | Bearer token is missing, invalid or expired. |
403 | You are not a practitioner, admin or System Owner, or you lack Device:create. |
422 | The body fails validation, a device you can see already has this name, or you send locationId and patientId for a discharged resident. |