Get zone device counts
- Sandbox: available
- Staging: available
- Production: unknown
Returns device counts per zone for your project, with project-wide totals. A zone is a FHIR Organization.
Auth: Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant Organization:search, Organization:read, Device:search and Device:read (an admin or super admin who holds no access policy skips this check).
Scope: The caller's project (from the token).
Behaviour
- By default,
deviceCountmatches the rowsGET /v1/slim/device/livereturns for each zone: devices assigned to a resident. all=truecounts every device in each zone, assigned or not, and ignoreseffectiveSleepStatus.effectiveSleepStatus(disconnected,connected,awake,away,asleep) counts only devices in that state. A device that is not active counts asdisconnected.includeUnassigned=truealso counts devices with no resident (unlessall=truealready does) and adds a bucket, withorganizationunset, for devices in no zone.includeEmpty=truekeeps project zones that have no matching devices, with zero counts.- For each zone,
assignedResidentDeviceCountcounts devices with a resident, andactiveDeviceCount/inactiveDeviceCountsplit devices by whether they are currently active. - Zones are sorted by
deviceCount, highest first.totalis the number of entries; thetotal…Countfields sum the per-zone counts.
Example
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/device-counts?includeEmpty=true&includeUnassigned=true' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'bearerAuthorizationBearer <JWT>all?stringWhen false or omitted, deviceCount matches the rows returned by /v1/slim/device/live for each zone (active residents only). Set to true to count all devices in each zone.
effectiveSleepStatus?string"disconnected""connected""awake""away""asleep"includeUnassigned?stringWhether to include an extra unassigned bucket for devices without a zone.
includeEmpty?stringWhether to include project zones that currently have zero matching devices.
Zone device counts retrieved successfully.
application/json- response
total*numbertotalDeviceCount*numbertotalAssignedResidentDeviceCount*numbertotalActiveDeviceCount*numbertotalInactiveDeviceCount*numberresources*array<>curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/device-counts'{ "total": 0, "totalDeviceCount": 0, "totalAssignedResidentDeviceCount": 0, "totalActiveDeviceCount": 0, "totalInactiveDeviceCount": 0, "resources": [ { "organization": { "resourceType": "Organization", "id": "string", "name": "string", "meta": { "project": "string", "lastUpdated": "string" } }, "deviceCount": 0, "assignedResidentDeviceCount": 0, "activeDeviceCount": 0, "inactiveDeviceCount": 0 } ]}List zones GET
Lists the zones of your project with their device counts. A zone is a FHIR `Organization`. Use it for a zone overview; use `GET /v1/slim/zones/{zoneId}` for one zone's locations. **Auth:** Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant `Organization:search`, `Organization:read` and `Device:read` (an admin or super admin who holds no access policy skips this check). **Scope:** The caller's project (from the token). ## Behaviour - Counts are taken from the same rows as `GET /v1/slim/device/live`: only devices assigned to a resident are counted. `deviceCount` is the number of such devices in the zone; `activeDeviceCount` and `inactiveDeviceCount` split them by whether the device is currently active, as on the live view. - Only zones with at least one counted device are listed. A zone with no assigned devices does not appear; `GET /v1/slim/zones/device-counts?includeEmpty=true` lists it. - `search` keeps zones whose name contains the text, ignoring case. - `sortBy`: `name` (default), `deviceCount`, `activeDeviceCount` or `inactiveDeviceCount`. `orderBy`: `ASC` (default) or `DESC`. - Paging: `page` from 0, `count` from 1 to 100 (default 20). `total` is the number of zones after the search filter. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones?sortBy=deviceCount&orderBy=DESC&page=0&count=20' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Get zone detail GET
Returns one zone with all of its locations and the devices and residents assigned to each location. A zone is a FHIR `Organization`. Use it for a zone drill-down view. **Auth:** Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant `Organization:read` and `Location:read` (an admin or super admin who holds no access policy skips this check). **Scope:** The zone must belong to the caller's project (from the token), its parent project, or one of its sub-projects. ## Behaviour - Returns every location whose managing organization is the zone; there is no paging. - Each location carries `floor`, `room` and `bed` when set, and its `devices` and `residents`. Devices and residents are sorted by name in natural order (so "Bed 2" sorts before "Bed 10"). - A location with no devices has empty `devices` and `residents` lists. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```