Skip to main content

Create device

MethodPath
POST/v1/slim/device

Authentication · Access policies

Creates a device in your project and, optionally, assigns it to a zone, a location and a resident in the same write.

Auth: bearer token. The caller must be a practitioner, an admin or a System Owner, and needs Device:create. Scope: the device is created in the caller's project (from the token).

Behaviour​

  • name is stored as the device's user-friendly name and as its official device identifier.
  • thingsboardId is stored as a second identifier. When you omit it, Ovok generates a random UUID for it.
  • organizationId, locationId and patientId are optional. Each one you send is assigned in the same transaction as the create. If any part fails, nothing is written.
  • Assigning a resident moves them: the resident is removed from every other device they hold, and their active out-of-bed episode is closed.
  • The device starts with status active.
  • The create is recorded in the change history.
  • The response is the same as GET /v1/slim/device/{id} for the new device.

Example​

curl -X POST 'https://api.sandbox.ovok.com/v1/slim/device' \
-H "Authorization: Bearer ${OVOK_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{"name": "Sleepiz/3001000", "locationId": "3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21"}'

Successful response​

201 — The created device.

Errors​

StatusMeaning
401Bearer token is missing, invalid or expired.
403You are not a practitioner, admin or System Owner, or you lack Device:create.
422The body fails validation, a device you can see already has this name, or you send locationId and patientId for a discharged resident.