Skip to main content

Create location in zone

MethodPath
POST/v1/slim/zones/:zoneId/locations

Authentication · Access policies

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 (admins and super admins skip 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​

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

Successful response​

201 — Location created in zone.

Errors​

StatusMeaning
401Bearer token is missing, invalid or expired.
403You are not a practitioner, admin or System Owner, you lack Location:create or Device:update, projectId is set by a caller who is not a super admin, your session has no project, or the zone is outside your project tree or carries no project.
404No zone with this zoneId exists.
409A location with the same floor, room and bed already exists in this zone.
422zoneId is not a UUID, the body fails validation, projectId is not a UUID or names no project, or a location with the same name already exists.