Bosch IoT Device Management

Manage features via Things HTTP API

In general, the Things service regards features as something that will change very often.
The usually represent data which is automatically retrieved from a device and thus provide insights into a device's functionality.

For example, think about a LED with can be switched on and of depending on how busy the device is.

Goal

Let us assume, your hello world thing already has a temperature feature that needs to be updated.

Procedure

Your entry point is again the Bosch IoT Things HTTP API

Authenticate

In order to use the Things HTTP API, you will need to authenticate. In this example we authenticate with a bearer token, using the client created in Provisioning via Device Provisioning API.

images/confluence/download/attachments/1634788016/things-auth.png

Close the pop-up.

List all features of a specific thing

This request simulates how your business application might request for the current device data.

  • Navigate to Feature > GET /things/{thingId}/features.

  • Click Try it out. to get access to the entry fields.

  • Set the thingId - in our example it is example.dm:hello-world-device-01.

  • Set the featureId - in our example it is temperature.

  • The other fields are optional and will stay empty for now.

  • Click Execute.

Response example:

{
"temperature": {
"properties": {
"status": {
"value": {
"currentMeasured": 0,
"minMeasured": 0,
"maxMeasured": 0
}
}
}
}
}

Create or update a specific property of a feature

This request simulates how your business application (or your device) might change the feature, e.g set the currentMeasured temperature to 42.

  • Navigate to Feature >PUT /things​/{thingId}​/features​/{featureId}​/properties​/{propertyPath}

    The PATCH request works similar, and is additionally more "forgiving" in case you instantiated the feature with a trailing empty character by mistake.

  • Click Try it out. to get access to the entry fields.

  • Set the thingId - in our example it is example.dm:hello-world-device-01.

  • Set the featureId - in our example it is temperature.

  • Set the propertyPath - in our example the complete path is status/value/currentMeasured

  • Set the Request body to 42.

  • Click Execute.

Result

The response is 204, meaning the feature property was successfully modified.

Check your work

You can either use the Bosch IoT Suite Console to see if the feature is changed, or you can request again all features using the HTTP API.

GET /things​/{thingId}​/features

A second GET request would respond like in the following snippet:

{
"temperature": {
"properties": {
"status": {
"value": {
"currentMeasured": 42,
"minMeasured": 0,
"maxMeasured": 0
}
}
}
}
}