Delete device
- Sandbox: available
- Staging: available
- Production: unknown
Deletes a device from your project.
Auth: bearer token. The caller must be a practitioner, an admin or a System Owner, and needs Device:delete. System Owners cannot delete devices.
Scope: the device must belong to the caller's project (from the token).
Behaviour
- The Device resource is deleted. This cannot be undone.
- If a resident is assigned, they are unassigned and their active out-of-bed episode is closed in the same transaction.
- The device's use history is updated in the same transaction.
- The delete is recorded in the change history.
- The response has no body.
Example
curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/device/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'bearerAuthorizationBearer <JWT>id*stringuuidDevice deleted. The response has no body.
curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/device/497f6eca-6276-4993-bfeb-53cbbbba6f08'Get device GET
Returns one device with its zone, location and resident assignments and its current connection status. Use it to show or edit a single device. **Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `Device:read`. **Scope:** the device is read with your token, so Medplum's access policy limits which devices you can read. ## Behaviour - `organizationId` is the zone of the device's location. When the device has no location, it falls back to the device's own owner organization. - `organizationName`, `locationName` and `patientName` are display names. Each is `null` when the resource has no name that can be shown. - `status` is `active` only when the device was last seen recently enough. A device whose last-seen time is stale reads `inactive`, even if it was never marked offline. A device without an identifier reports its stored FHIR status. - `statusReason` explains an `inactive` status when the platform recorded why. - `floor`, `room` and `bed` come from the address of the device's location. - Read-only. Nothing is written. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/device/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Update device PUT
Updates a device's name and identifier, and assigns or unassigns its zone, location and resident. **Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `Device:update`. **Scope:** the device must belong to the caller's project (from the token). ## Behaviour - `name` is required and replaces the device's user-friendly name, trimmed. Renaming the device to a serial that a device of another customer already holds is refused with 409, in any spelling. - Renaming the device to a serial another device of your project holds is refused with 422, in any spelling: spaces around it or its `/`, other case, with or without the manufacturer prefix ingest gives the serial. A device may take another spelling of its own serial. - For `organizationId`, `locationId` and `patientId`: omit the field to leave it unchanged, send `null` to unassign, or send a UUID to assign. - A device in a room is in the room's zone. An `organizationId` that differs from the zone of the device's room (the room you send, or the one it is in) answers 422 with `path: ["organizationId"]` and changes nothing: move the room to that zone, or the device to a room in it. A device with no room, or in a room with no zone, takes any zone. A zone change re-zones only the device, never its room, the room's other devices or a resident. - Assigning a resident moves them: the resident is removed from every other device they hold. The resident who was on this device before loses it. Each resident who loses a device has their active out-of-bed episode closed in the same transaction. - Assigning a resident who is not active (`discharged`, `discharged-recent` or `archived`) is refused with 422 and changes nothing: reactivate them first. Unassigning one (`patientId: null`) is allowed. - All changes are written in one transaction. If any part fails, nothing is written. - Sending values the device already has is not an error, and writes nothing. - Resident assignment changes, renames, identifier changes and zone changes are recorded in the change history. - The response is the same as `GET /v1/slim/device/{id}` after the update. ## Example ```bash curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/device/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{"name": "Sleepiz/3001000", "patientId": null}' ```