Bosch IoT Device Management

Manage attributes via Manager HTTP API

In general, the Things service 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 Console), 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

Navigate to the API docs

Bosch IoT Manager > Devices

PUT​/di​/devices​/{deviceId}​/attributes Add Attribute of a specific Device

Authorize

Click images/confluence/download/thumbnails/1647788999/Authorize-button.png 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).

images/confluence/download/attachments/1647788999/auth-manager-apidocs.png

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 Bosch IoT Things.

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.

images/confluence/download/attachments/1647788996/manager-attributes.png

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 Console, then re-try the POST request.

  • Things UI - navigate to Connections/Integrations > 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.