Setting a device register value
Setting the value of a register.
To access the API you must provide the `bearer token`.
Send a PUT
request to the API endpoint /api/orgs/{org-slug}/device/{device-id}/register/{register-id}
with the body:
{
"value": <register value>
}
Replace {org-slug}
with your organisations slug.
Replace {device-id}
with the device id.
Replace {register-id}
with the register id.
You can find your slug:
- in the organisations settings page
- from the organisations API
The device ID is available from the listing devices API.
The register ID is available from the listing device registers API.
This will return a device register object, for example:
{
"success": "register updated"
}
Example:
curl -X 'PUT' \
'https://iotsimhub.net/api/orgs/<org-slug>/device/<device-id>/register/<register-id>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer <token>" \
-d '{ "value": <value> }'
API error codes
The endpoint will return errors in the format:
{
"errors": {
"details": <error response>
}
}
Error response | Description |
---|---|
Unauthorized | The request was not successful because: 1.You are not authenticated. 2. You are not part of the organisation |
Not found | The device ID was not found in this organisation or the register ID was not found on the device |
Value invalid for data type | The register could not be updated. The value was not the same type defined by the register. |