Manage attributes via Manager HTTP API
In general, the digital twin layer regards attributes as something that does not change very often. By default you should be allowed to read and write attributes.
Goal
Let us assume, your device your.namespace:hello-world-device-01 already has manufacturer attributes (like created in section Manage attributes via Bosch IoT Suite UI), and you want to add further attributes, or change a value.
Think for example of scenarios where you might need to filter for all devices of a specific manufacturer.
Procedure
Authorize
Click in the top right area of the screen or the similar icon to the right of the respective method in order to get a pop-up offering basic authentication.
In this example, you will mimic the remote management UI hello-world-device. Therefore, please authenticate with a Suite Auth token (the same as you created during Provisioning via Device Provisioning API).
Close the pop-up.
Get all attributes of the hello world device
Navigate to GET /di/devices/{deviceId}/attributes
Click Try it out - to get access to the input fields.
deviceId: set the full name, e.g. your-namespace:hello-world-device-01
Execute.
The response would be for example:
[
{
"path"
:
"Info"
,
"value"
: {
"displayName"
:
""
,
"gateway"
:
false
}
}
]
Add the manufacturer attributes
Navigate to PUT /di/devices/{deviceId}/attributes
Click Try it out - to get access to the input fields.
deviceId: set the full name, e.g. your-namespace:hello-world-device-01
Set the Request body.
It must be of type application/json.
It must respect the thing's notation.
In our case the request body looks like this:{
"path"
:
"manufacturer"
,
"value"
: {
"name"
:
"ACME demo corp."
,
"location"
:
"London"
,
"serialno"
:
"420"
,
"model"
:
"fancy"
}
}
Execute
The response code 200 indicates success.
can't parse JSON. Raw result:
The Attribute of the specific Device was successfully added.
You can re-execute the GET request to see the change.
Check your work
The changes triggered via the Bosch IoT Manager API are forwarded to the digital twin layer.
You can see the latest values in Bosch IoT Consoles.
E.g. Refresh the thing's attributes view in Bosch IoT Suite console to see the results.
Tips for debugging
Please check if the change has be applied.
Developer Console - in case all attributes are missing - the mapping failed just because the path you have mentioned in the request body does not exist.
Follow the steps at Manage attributes via Bosch IoT Suite UI, then re-try the POST request.Connections UI > Device Management > Metrics > click one of the numbers in a "failure" cell.
Activate the log entries and Refresh automatically.
Re-try the PUT request and see the detailed failure message.