SlimSlim/Device

Move device to another project

  • Sandbox: available
  • Staging: available
  • Production: unknown
PUT
/v1/slim/device/assign/project

Moves a device into another project in your project tree, and optionally places it in a location there.

Auth: bearer token. The caller must be a practitioner, an admin or a System Owner, and needs Device:update. Scope: the device must be in the caller's project or one of its sub-projects. The target projectId must be your project, its parent or one of its sub-projects.

Behaviour

  • The device's resident, location and zone are removed before the move, because those references belong to the old project.
  • If a resident was assigned, their active out-of-bed episode is closed and their open device use record is ended, in the same write.
  • When you send locationId, the device is placed in that location. The location must be in the target project.
  • The move is written in one transaction. If it fails, nothing is written.
  • Moving a device to the project it is already in writes nothing and still succeeds.
  • The response is { success, deviceId, projectId, locationId }. locationId is null when you sent none.

Example

curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/device/assign/project' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \  -H 'Content-Type: application/json' \  -d '{"deviceId": "c3499c27-2973-0a7f-807e-fb8676a92dcb", "projectId": "87ea5dfc-8b8e-384d-8489-79496e706390"}'

Authorization

bearer
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body
deviceId*string

Id of the Device to move.

Formatuuid
projectId*string

Id of the target project: your project, its parent or a sub-project.

Formatuuid
locationId?string

Optional location in the target project to place the device in.

Formatuuid

Response Body

Device moved to the target project.

application/json
  1. response
success*true
Value intrue
deviceId*string

Id of the Device that was moved.

projectId*string

Id of the project the device now belongs to.

Formatuuid
locationId*string

Id of the location the device was placed in, or null when none was sent.

Formatuuid
Example Request
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/device/assign/project' \  -H 'Content-Type: application/json' \  -d '{  "deviceId": "4de4adb9-21ee-47e3-aeb4-8cf8ed6c109a",  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8"}'
Example Response
{  "success": true,  "deviceId": "string",  "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8",  "locationId": "1a5515a3-ba81-4a42-aee7-ad9ffc090a54"}

List projects for device assignment GET

Lists the projects you can move a device into: your own project, its parent project and its sub-projects. **Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `Device:update`. **Scope:** the caller's project (from the token) and its parent and sub-projects. ## Behaviour - Each entry is `{ project: { id, name } }`. `name` is an empty string when the project has none. - `total` is the number of projects returned. - Read-only. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/device/assign/project' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```

List devices GET

Lists the devices in your project with their zone, location and resident names. Use it for device directory and administration screens. **Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `Device:search` and `Device:read`. **Scope:** the caller's project (from the token). ## Behaviour - Every device in the project is listed, whether or not it has a location or resident. - `id` is the Device resource id. `thingsboardId` is the device identifier that telemetry is keyed by. - `status` is `active` when the device's live telemetry reports it active, otherwise `inactive`. - `lastActivityTime` is the latest telemetry activity time, or the device's last-seen time when telemetry has none. - `search` matches device, location and zone names. `patientSearch` matches resident names. Both are case-insensitive substring matches. - `organizationId`, `locationId`, `patientId` and `active` filter on exact values. - `orderBy` is `ASC` or `DESC` in any case, default `ASC`. Rows with an empty sort value sort last in `ASC` order and first in `DESC` order. - `page` is zero-based. `count` defaults to 20, maximum 100. `total` is the number of rows after filtering. - The device structure is cached for up to 5 minutes. Writes made through the Slim routes refresh it sooner. - If the device list cannot be built and no earlier complete list exists, the route returns 503. Retry shortly. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/device?page=0&count=20&sortBy=deviceName&orderBy=ASC' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```