SlimSlim/Zones

Get zone detail

  • Sandbox: available
  • Staging: available
  • Production: unknown
GET
/v1/slim/zones/{zoneId}

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

curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/c3499c27-2973-0a7f-807e-fb8676a92dcb' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

zoneId*string
Formatuuid

Response Body

Zone detail with nested locations, devices and residents.

application/json
  1. response

Zone detail with nested locations, devices and residents per location.

id*string
name*string
locations*array<>
Example Request
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "id": "string",  "name": "string",  "locations": [    {      "id": "string",      "name": "string",      "floor": "string",      "room": "string",      "bed": "string",      "devices": [        {          "id": "string",          "name": "string"        }      ],      "residents": [        {          "id": "string",          "name": "string"        }      ]    }  ]}

Get zone device counts GET

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 ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/device-counts?includeEmpty=true&includeUnassigned=true' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```

Create location in zone POST

Creates a location (a FHIR `Location`) inside a zone. The new location's managing organization is the zone. **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 `Location:create` and `Device:update` (an admin or super admin who holds no access policy skips this check). **Scope:** The location is created in the caller's project (from the token). A super-admin caller may pass `?projectId=<uuid>` to create it in that project instead; the project must exist. The zone must belong to the project in use, its parent project, or one of its sub-projects. ## Behaviour - `name` is required and must be unique among the locations your token can search. - `floor`, `room` and `bed` are optional. When at least one is set, no other location in the zone may have the same floor, room and bed. A location with none of them is checked by name only. - The location is created with no devices or residents. Assign them with `PUT /v1/slim/zones/{zoneId}/locations/{locationId}`. - A location-created entry is added to the change history. A failure to write that entry does not fail the request. - The response is the new location, in the same shape as `GET /v1/slim/location/{id}`. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/slim/zones/c3499c27-2973-0a7f-807e-fb8676a92dcb/locations' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "name": "Room 101 Bed 1", "floor": "1", "room": "101", "bed": "1" }' ```