Delete location in zone
Delete location in zone using Ovok’s Slim API.
| Method | Path |
|---|---|
DELETE | /v1/slim/zones/:zoneId/locations/:locationId |
Authentication · Access policies
Deletes an empty location from a zone, or, with dryRun=true, previews which devices and residents are at it without changing anything.
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:update and Device:update (admins and super admins skip this check).
Scope: The zone must belong to the caller's project (from the token), its parent project, or one of its sub-projects. The location must belong to the zone and to your project or a sub-project; a parent project's location is refused.
Request
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
zoneId | string (uuid) | Yes | Zone (organization) id. |
locationId | string (uuid) | Yes | Location id. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
dryRun | boolean | No | true returns a preview and deletes nothing. Any other value, or none, deletes the location. |
Behaviour
dryRun=truereturns200withaffected_devicesandaffected_residentsat the location, and awarningwhen either list is not empty. Nothing is written.- Without
dryRun(any other value counts as false), the location is deleted only when no device is assigned to it. The call answers204with no body. - Reassign the location's devices before deleting it; the delete never unassigns devices for you.
- A location-deleted entry is added to the change history. A failure to write that entry does not fail the request.
Example
curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/zones/1e6b8d30-2c4f-4a95-8d7e-b0a2c4e6f918/locations/5d2a9c64-7e1b-4830-b6f5-9a3c1e8d7b02?dryRun=true' \
-H "Authorization: Bearer ${OVOK_TOKEN}"Successful response
200 — With dryRun=true: a preview of the devices and residents at the location. Nothing is deleted.
204 — Without dryRun=true: the location is deleted. No body.
The body of the 200 preview:
{
"warning": "Deleting this location is blocked while devices are assigned. Reassign the devices first.",
"affected_devices": [{ "id": "8c5e7a21-4b9d-4f36-a1c8-0d2e6b9f3a54", "name": "Demo/1000001" }],
"affected_residents": [{ "id": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21", "name": "demo-resident" }]
}| Field | Type | Description |
|---|---|---|
warning | string | Present when the location has devices or residents. Left out otherwise. |
affected_devices | object[] | Devices at the location. Empty array when there are none. |
affected_devices[].id | string (uuid) | Device id. |
affected_devices[].name | string | Device name. Left out when it has none. |
affected_residents | object[] | Residents on those devices. Empty array when there are none. |
affected_residents[].id | string (uuid) | Patient id. |
affected_residents[].name | string | The resident's name. Left out when the resident has no name. |
Errors
| Status | Meaning |
|---|---|
401 | Bearer token is missing, invalid or expired. |
403 | You are not a practitioner, admin or System Owner, you lack Location:update or Device:update, your session has no project, the zone or the location is outside your project, or the location is not in this zone. |
404 | No zone with this zoneId, or no location with this locationId, exists. |
409 | Another write holds a lock on this location or its devices. Retry the call. |
422 | A path parameter is not a UUID, or devices are still assigned to the location (delete only). |
Last updated on