Devices
Move device to another project
Move device to another project using Ovok’s Slim API.
| Method | Path |
|---|---|
PUT | /v1/slim/device/assign/project |
Authentication · Access policies
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.
Request
Body
The body is strict: a field that is not listed here fails validation.
| Name | Type | Required | Description |
|---|---|---|---|
deviceId | string (uuid) | Yes | Id of the device to move. |
projectId | string (uuid) | Yes | Id of the target project: your project, its parent or a sub-project. |
locationId | string (uuid) | No | Location in the target project to place the device in. |
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 still removes its resident, location and zone. Send
locationIdto place it in a location again. - The response is
{ success, deviceId, projectId, locationId }.locationIdisnullwhen you sent none.
Example
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/device/assign/project' \
-H "Authorization: Bearer ${OVOK_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{"deviceId": "8c5e7a21-4b9d-4f36-a1c8-0d2e6b9f3a54", "projectId": "b7a3d915-6e20-4c8f-9a14-3d5f7b9c1e68"}'Successful response
200 — Device moved to the target project.
{
"success": true,
"deviceId": "8c5e7a21-4b9d-4f36-a1c8-0d2e6b9f3a54",
"projectId": "b7a3d915-6e20-4c8f-9a14-3d5f7b9c1e68",
"locationId": null
}| Field | Type | Description |
|---|---|---|
success | boolean | Always true. |
deviceId | string (uuid) | Id of the device that was moved. |
projectId | string (uuid) | Id of the project the device now belongs to. |
locationId | string (uuid) | null | Id of the location the device was placed in. null when you sent none. |
Errors
| Status | Meaning |
|---|---|
401 | Bearer token is missing, invalid or expired. |
403 | You are not a practitioner, admin or System Owner, you lack Device:update, your session has no project, the device is outside your project or sub-projects, the target project is outside your project tree, or the location is not in the target project. |
404 | No device with this deviceId exists. |
409 | The device's current project or the target project is moving to another Signals tenant. Retry when the move is done. |
422 | The body fails validation. |
Last updated on