Skip to main content

Update location in zone

MethodPath
PUT/v1/slim/zones/:zoneId/locations/:locationId

Authentication · Access policies

Updates a location in a zone: its name, floor, room and bed, the devices assigned to it, and the resident on those devices.

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 be in the caller's project, and its managing organization must be the zone. Devices and residents named in the body must be in your project or a sub-project.

Behaviour​

  • name is required and must be unique among the locations your token can search, not counting this one.
  • floor, room and bed replace only the values you send; omitted ones keep their stored value. The resulting floor, room and bed must not match another location in the zone.
  • deviceId (one UUID or a list) sets the devices at the location to exactly that set: devices not listed are removed from it, new ones are added. null removes every device. Omit deviceId to leave the devices unchanged.
  • patientId assigns that resident to the devices named in deviceId, or, without deviceId, to the location's single device. A resident assigned there before is unassigned from those devices.
  • Omitting patientId unassigns the current resident from every device at the location (and from the devices in deviceId). Send the current patientId to keep the resident.
  • A discharged resident cannot be assigned.
  • The write is atomic and takes a short write lock on the devices and locations it touches.
  • The response is the updated location, in the same shape as GET /v1/slim/location/{id}.

Example​

curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/zones/3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21/locations/3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21' \
-H "Authorization: Bearer ${OVOK_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{
"name": "Room 101 Bed 1",
"room": "101",
"bed": "1",
"deviceId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21",
"patientId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21"
}'

Successful response​

200 — Updated location.

Errors​

StatusMeaning
401Bearer token is missing, invalid or expired.
403You are not a practitioner, admin or System Owner, you lack Location:update or Device:update, your session has no project, the zone is outside your project tree or carries no project, the location is not in this zone or not in your project, or a device or resident in the body is outside your project.
404No zone with this zoneId, or no location with this locationId, exists.
409A location with the same floor, room and bed already exists in this zone, or another write holds a lock on one of the devices or locations. Retry the call.
422A path parameter is not a UUID, the body fails validation, a location with the same name already exists, a resident is discharged, or patientId is sent without deviceId while the location has no device or several.