SlimSlim/Location

Delete location

  • Sandbox: available
  • Staging: available
  • Production: unknown
DELETE
/v1/slim/location/{id}

Deletes a location that has no devices attached.

Auth: Bearer token. The caller must be a Medplum project admin or super admin. The access policy must grant Location:delete and Device:update (an admin or super admin who holds no access policy skips the access-policy check). Scope: The location must belong to the caller's project (from the token).

Behaviour

  • Detach every device first (PUT /v1/slim/location/{id} with "deviceId": []). A location with a device attached is refused.
  • The Location resource is deleted.
  • The write is atomic and takes a short write lock. A concurrent write to the same location gets a 409.
  • A location-deleted entry is added to the change history. A failure to write that entry does not fail the request.
  • The response has no body.

Example

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

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

id*string
Formatuuid

Response Body

Location deleted. The response has no body.

Example Request
curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/location/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
Empty

Get location GET

Returns one location (room or bed) by id, with its zone, devices and resident. **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:read` (an admin or super admin who holds no access policy skips this check). **Scope:** The location is read with the caller's own token, so you get any location your Medplum access lets you read. There is no extra project check on this route. ## Behaviour - Read-only. - `floor`, `room` and `bed` come from the location's type codes. - `organizationId` and `organizationName` are the location's zone (`Location.managingOrganization`). - `deviceId` lists every device at the location. `deviceName` is the alphabetically first of their names. - `patientId` and `patientName` are the resident on the first device at the location that has one. - Fields with no value are omitted. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/location/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ``` ```json { "id": "c3499c27-2973-0a7f-807e-fb8676a92dcb", "name": "Room 201", "floor": "2", "room": "201", "bed": "A", "organizationId": "87ea5dfc-8b8e-384d-8489-79496e706390", "organizationName": "Ward A", "deviceId": ["..."], "deviceName": "...", "patientId": "...", "patientName": "Maxi" } ```

Update location PUT

Updates a location: its name, floor, room, bed and zone, the devices at 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` (an admin or super admin who holds no access policy skips this check). **Scope:** The location must belong to the caller's project (from the token). Devices and residents you attach must be in your project or one of its sub-projects. The zone must be in your project, a sub-project, or the parent project. ## Behaviour - `name` is required and must be unique among the locations your token can search, not counting this one. - `floor`, `room`, `bed`: an omitted field keeps its current value. If the zone, floor, room or bed changes, the new combination must not match another location's. - `organizationId`: - omitted: the zone is unchanged. - `null`: the zone is removed from the location and from every device at it. - an id: the location and every device at it move to that zone. Residents on those devices move too. - `deviceId` (one id or a list): - omitted: the devices at the location are unchanged. - a list: it becomes the full set of devices at the location. Devices not in the list are detached; new ones are attached. `null` or `[]` detaches all devices. - Devices that hold a discharged resident cannot be attached. - `patientId`: - an id: that resident is assigned to the devices in `deviceId`, or, when `deviceId` is omitted or empty, to the single device at the location. The resident is first removed from any other device. A resident already on a target device is replaced. A discharged resident is refused. - **omitted: every resident is removed from every device at the location and every device in `deviceId`.** To keep the current resident, send their `patientId`. - A resident who loses a device has their active out-of-bed notification revoked in the same write, and the device's live telemetry state is cleared afterwards. - Device use history is updated for every device whose resident changes. - The write is atomic and takes a short write lock. A concurrent write to the same resources, or a device reassigned by someone else while this request ran, gets a 409. - Every save adds a location-updated entry to the change history. Residents who move into a new zone, or lose a device, also get an entry in their own change history. - The response is the location after the update, in the same shape as `GET /v1/slim/location/{id}`. - If another location has the same zone, floor, room and bed, the request is refused with 409 and the body carries `existingLocationId` and `existingLocationName`. ## Example ```bash curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/location/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "name": "Room 201", "floor": "2", "room": "201", "bed": "A", "organizationId": "87ea5dfc-8b8e-384d-8489-79496e706390", "deviceId": ["c3499c27-2973-0a7f-807e-fb8676a92dcb"], "patientId": "c3499c27-2973-0a7f-807e-fb8676a92dcb" }' ```