Get location
- Sandbox: available
- Staging: available
- Production: unknown
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,roomandbedcome from the location's type codes.organizationIdandorganizationNameare the location's zone (Location.managingOrganization).deviceIdlists every device at the location.deviceNameis the alphabetically first of their names.patientIdandpatientNameare the resident on the first device at the location that has one.- Fields with no value are omitted.
Example
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/location/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'{ "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"}bearerAuthorizationBearer <JWT>id*stringuuidLocation retrieved successfully.
application/json- response
id*stringLocation id.
name*stringfloor?stringroom?stringbed?stringorganizationId?stringorganizationName?stringdeviceId?array<string>Every device at the location. Omitted when the location has none.
deviceName?stringAlphabetically first name among the devices at the location.
patientId?stringResident on the first device at the location that has one.
patientName?stringcurl -X GET 'https://api.sandbox.ovok.com/v1/slim/location/497f6eca-6276-4993-bfeb-53cbbbba6f08'{ "id": "string", "name": "string", "floor": "string", "room": "string", "bed": "string", "organizationId": "string", "organizationName": "string", "deviceId": [ "string" ], "deviceName": "string", "patientId": "string", "patientName": "string"}Create location in a project (admin) POST
Creates a location in a given project. The admin dashboard uses it during device assignment, when the right room does not exist yet. **Auth:** Bearer token. The caller must be a Medplum project admin. Super admins without the admin role, practitioners and System Owner callers are refused. The access-policy check (`Location:create`) is skipped only for an admin who holds no access policy. **Scope:** The project named by `projectId` in the body. The location is created with Ovok's admin client and stamped with that project. ## Behaviour - `floor`, `room` and `bed` are stored as type codes. `organizationId` sets the zone (`managingOrganization`). - The location is created with `status: active`. - Unlike `POST /v1/slim/location`, this route does not check for a duplicate name or a duplicate floor, room and bed, and adds no change-history entry. - The response is `{ id, name, projectId }` of the created location. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/slim/location/admin' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "projectId": "c3499c27-2973-0a7f-807e-fb8676a92dcb", "name": "Room 18", "floor": "2", "room": "18", "organizationId": "87ea5dfc-8b8e-384d-8489-79496e706390" }' ```
Delete location DELETE
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 ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/location/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```