Devices

Move device to another project

Move device to another project using Ovok’s Slim API.

MethodPath
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.

NameTypeRequiredDescription
deviceIdstring (uuid)YesId of the device to move.
projectIdstring (uuid)YesId of the target project: your project, its parent or a sub-project.
locationIdstring (uuid)NoLocation 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 locationId to place it in a location again.
  • 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 ${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
}
FieldTypeDescription
successbooleanAlways true.
deviceIdstring (uuid)Id of the device that was moved.
projectIdstring (uuid)Id of the project the device now belongs to.
locationIdstring (uuid) | nullId of the location the device was placed in. null when you sent none.

Errors

StatusMeaning
401Bearer token is missing, invalid or expired.
403You 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.
404No device with this deviceId exists.
409The device's current project or the target project is moving to another Signals tenant. Retry when the move is done.
422The body fails validation.

Last updated on

On this page