Sofar logo
Sofar logo
Api
Collect devices (replaced by POST /v1/device/query) GETPerform a series of targeted update operations PATCHCreate a new device and the monitors relation which connects this device to a role POSTCollect devices POSTUpdate an existing device PUT
Device
PATCH
/v1/device/{deviceId}

Authorization

accessBearerAuth

Collect devices (replaced by POST /v1/device/query) GET

Get all (or some of) the devices which are monitored by roles of which the user is a member. Using the query parameters, it is possible to apply filters both on devices which are returned, and on the properties of those devices. The POST /v1/device/query is a preferable alternative, which can better handle complex filters

Create a new device and the monitors relation which connects this device to a role POST

A user can only execute this call is he is a member of an authorizing role which satisfies one of the following conditions: <ul> <li> The authorizing role has *direct or indirect* deviceManagement rights for the role for which a device is created </li> <li> The authorizing role has *indirect* roleManagement rights for the role for which a device is created </li> </ul>

Authorization
Bearer <token>

In the value field below, fill in the access token. It has a 10 minutes validity period. A valid token can be obtained via the /accesstoken endpoint (call), AFTER authorization with refreshBearerAuth and the refresh token.

In: header

Path Parameters

deviceId*|array<>

Id of the device or devices which we want to edit

Query Parameters

validate?boolean

Before executing the update, validate the updated device using the schema corresponding to its nodeType (if such a schema exists)

Header Parameters

If-Unmodified-Since?string

An ISO 8601 time or a time of the format '<day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT', specifying the latest timestamp any of the affected devices might have received an update in order for the request to be executed. A code 412 error will be returned if at least one device was updated after the specified time

Request Body

application/json

The JSON patch operations

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://api.eniris.be/v1/device/0" \  -H "Content-Type: application/json" \  -d '[    {      "op": "add",      "path": "string",      "value": null    }  ]'
{
  "device": {
    "id": 0,
    "lastUpdate": "string",
    "properties": {},
    "userRights": {
      "propertyEditabilities": {
        "property1": true,
        "property2": true
      },
      "monitorManagement": true
    }
  }
}
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Missing or misformatted query parameter or body"
}
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Failed to verify token"
}
{
  "statusCode": 412,
  "error": "Precondition Failed",
  "message": "At least one device was modified after the specified time"
}
{
  "statusCode": 422,
  "error": "Unprocessable Entity",
  "message": "Operation 0 (add) failed for device 2 at path \"/info/currency\""
}

Patch the properties of one or more devices by specifying JSON patch operations which should be applied to the device properties in accordance with RFC 6902. A user can only execute this call when is he is a member of an authorizing role such that this role has a monitors relation with monitorManagement rights. Alternatively, the user must be member of a set of roles with monitors relations for the specified device, such that the set of device properties which these relations allow to edit are a subset of the device properties which are specified in the current request.