Create device
- Sandbox: available
- Staging: available
- Production: unknown
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, trimmed, as the device's user-friendly name and as its official device identifier.- A
namewhose serial a device of your project already holds is refused with 422, in any spelling: spaces around it or its/, other case, with or without the manufacturer prefix ingest gives the serial (Sleepiz/30QD24001,sleepiz/30qd24001and30QD24001hold one serial). Ingest finds a device by its serial, so one serial belongs to one device. - A
namewhose serial a device of another customer already holds is refused with 409, in the same spellings. Ingest routes readings by serial, and cannot tell two customers' devices with one serial apart. 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.- A device in a room is in the room's zone. An
organizationIdthat differs from the zone of the device's room (the room you send, or the one it is in) answers 422 withpath: ["organizationId"]and changes nothing: move the room to that zone, or the device to a room in it. A device with no room, or in a room with no zone, takes any zone. A zone change re-zones only the device, never its room, the room's other devices or a resident. - Assigning a resident moves them: the resident is removed from every other device they hold, and their active out-of-bed episode is closed.
- Assigning a resident who is not active (
discharged,discharged-recentorarchived) is refused with 422 and nothing is created: reactivate them first. - 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 eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{"name": "Sleepiz/3001000", "locationId": "c3499c27-2973-0a7f-807e-fb8676a92dcb"}'bearerAuthorizationBearer <JWT>application/json- body
name*string1 <= lengththingsboardId?string1 <= lengthorganizationId?stringuuidlocationId?stringuuidpatientId?stringuuidThe created device.
application/json- response
id*stringDevice resource id.
name*stringstatus?string"active""inactive""entered-in-error""unknown"statusReason*array<>thingsboardId?stringorganizationId?stringorganizationName*stringlocationId?stringlocationName*stringpatientId?stringpatientName*stringfloor?stringroom?stringbed?stringcurl -X POST 'https://api.sandbox.ovok.com/v1/slim/device' \ -H 'Content-Type: application/json' \ -d '{ "name": "string"}'{ "id": "string", "name": "string", "status": "active", "statusReason": [ { "code": "string", "display": "string" } ], "thingsboardId": "string", "organizationId": "string", "organizationName": "string", "locationId": "string", "locationName": "string", "patientId": "string", "patientName": "string", "floor": "string", "room": "string", "bed": "string"}List devices GET
Lists the devices in your project with their zone, location and resident names. Use it for device directory and administration screens. **Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `Device:search` and `Device:read`. **Scope:** the caller's project (from the token). ## Behaviour - Every device in the project is listed, whether or not it has a location or resident. - `id` is the Device resource id. `thingsboardId` is the device identifier that telemetry is keyed by. - `status` is `active` when the device's live telemetry reports it active, otherwise `inactive`. - `lastActivityTime` is the latest telemetry activity time, or the device's last-seen time when telemetry has none. - `search` matches device, location and zone names. `patientSearch` matches resident names. Both are case-insensitive substring matches. - `organizationId`, `locationId`, `patientId` and `active` filter on exact values. - `orderBy` is `ASC` or `DESC` in any case, default `ASC`. Rows with an empty sort value sort last in `ASC` order and first in `DESC` order. - `page` is zero-based. `count` defaults to 20, maximum 100. `total` is the number of rows after filtering. - The device structure is cached for up to 5 minutes. Writes made through the Slim routes refresh it sooner. - If the device list cannot be built and no earlier complete list exists, the route returns 503. Retry shortly. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/device?page=0&count=20&sortBy=deviceName&orderBy=ASC' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
List live device rows GET
Lists live device rows for the dashboard's monitoring views: each device with its resident, location, zone, current telemetry and alerts. **Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `search` and `read` on `Patient`, `Device`, `Location`, `Observation` and `Organization`. **Scope:** the caller's project (from the token). ## Behaviour - By default only devices with a resident assigned are returned. Set `includeUnassigned=true` to include devices without a resident. - `organizationId` takes a zone id, `assigned` or `unassigned`. A zone id also matches devices in its child zones. - `deviceId` restricts the result to one device, matched against the device identifier. - `effectiveSleepStatus` filters on the device's current sleep status. - `search` matches resident nickname and name, location name, zone name, and device name, identifier and serial. The resident, location and zone names match fuzzily; the device fields match only as a case-insensitive substring, so a full device name finds that device alone. - `orderBy` is `ASC` or `DESC` in any case, default `ASC`. - `residentState` is accepted but ignored. - A row's `patient` carries the resident's `id`, `name`, `meta` and `extension` only, not the whole FHIR Patient. - Telemetry is read fresh on every request. The device structure is cached and refreshed when you write through the Slim routes. - `page` is zero-based. `count` defaults to 20, maximum 100. - For polling only the telemetry and alerts, use `GET /v1/slim/device/live/telemetry` with the same query. - The route returns 503 when the server is at capacity for live reads or the device list cannot be built. Retry shortly. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/device/live?page=0&count=20&sortBy=locationName&orderBy=ASC' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```