SlimSlim/Zones

Get zone device counts

  • Sandbox: available
  • Staging: available
  • Production: unknown
GET
/v1/slim/zones/device-counts

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, deviceCount matches the rows GET /v1/slim/device/live returns for each zone: devices assigned to a resident.
  • all=true counts every device in each zone, assigned or not, and ignores effectiveSleepStatus.
  • effectiveSleepStatus (disconnected, connected, awake, away, asleep) counts only devices in that state. A device that is not active counts as disconnected.
  • includeUnassigned=true also counts devices with no resident (unless all=true already does) and adds a bucket, with organization unset, for devices in no zone.
  • includeEmpty=true keeps project zones that have no matching devices, with zero counts.
  • For each zone, assignedResidentDeviceCount counts devices with a resident, and activeDeviceCount / inactiveDeviceCount split devices by whether they are currently active.
  • Zones are sorted by deviceCount, highest first. total is the number of entries; the total…Count fields 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'

Authorization

bearer
headerAuthorizationBearer <JWT>

Query Parameters

all?string

When 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
Value in"disconnected""connected""awake""away""asleep"
includeUnassigned?string

Whether to include an extra unassigned bucket for devices without a zone.

includeEmpty?string

Whether to include project zones that currently have zero matching devices.

Response Body

Zone device counts retrieved successfully.

application/json
  1. response
total*number
totalDeviceCount*number
totalAssignedResidentDeviceCount*number
totalActiveDeviceCount*number
totalInactiveDeviceCount*number
resources*array<>
Example Request
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/device-counts'
Example Response
{  "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' ```