Device provisioning with Eclipse Vorto model

In this example, we assume the thing you create has been modeled already with Eclipse Vorto and is available in the Vorto GitHub repository.

For provisioning a thing with a structure based on an Eclipse Vorto information model you will need to set the definition in the request body.

Your entry point into our interactive API documentation is Bosch IoT Suite - Device Provisioning.

Provisioning request

  1. Authorize with a JWT (e.g. Create a Suite Auth client)

  2. Use the provisioning resource.
    POST /{service-instance-id}/devices

  3. Click Try it out to get all entry fields editable.

  4. Set the service-instance-id.
    If you have not stored your credentials at the end of the step Getting started with a simple device,
    open an new tab and navigate https://bosch-iot-suite.com/ > Service Subscriptions > your instance > ... Show Credentials
    copy the value of your Service Instance ID and switch back to the API docs to enter it in the respective field.

  5. Set the authScope to deviceManagementSubscription.

  6. Set the definitionResolver to "vorto".

  7. Edit the content for the request body.

    1. The ID is composed of yournamspace and the device name, separated by a colon : character.

    2. The definition pattern is namespace:name:version
      Let us assume you want to provision a new device based on a model which is already available in the Eclipse Vorto GitHub repository,
      e.g. https://github.com/eclipse/vorto/tree/development/models/com.bosch.iot.suite.example-VirtualDemoDevice-2.0.0.infomodel → the definition notation would be com.bosch.iot.suite.example:VirtualDemoDevice:2.0.0.

      Example request body

      {
      "id": "my.demo.namespace:my-device-4711",
      "hub": {
      "device": {
      "enabled": true
      },
      "credentials": {
      "type": "hashed-password",
      "secrets": [
      {
      "password": "yourPassword"
      }
      ]
      }
      },
      "things": {
      "thing": {
      "definition": "com.bosch.iot.suite.example:VirtualDemoDevice:2.0.0",
      "attributes": {
      "manufacturer": "Robert Bosch GmbH"
      }
      }
      }
      }
  8. Click Execute to submit the request.

  9. Verify that the request was successful Code 201.

Response

You can download the result as JSON for further requests.

In case your device should be provisioned without any Vorto definition, omit specifying a definitionResolver.

Check your work

Navigate to /Things/get_things

Set the thing ID my.demo.namespace:my-device-4711

The response should show the structure created.

{
"thingId": "my.demo.namespace:my-device-4711",
"policyId": "my.demo.namespace:my-device-4711",
"definition": "com.bosch.iot.suite.example:VirtualDemoDevice:2.0.0",
"attributes": {
"manufacturer": "Robert Bosch GmbH"
},
"features": {
"softwareUpdates": {
"definition": [
"org.eclipse.hawkbit.swupdatable:SoftwareUpdatable:2.0.0"
],
"properties": {
"status": {
"softwareModuleType": "",
"installedDependencies": {
"key": "value"
},
"contextDependencies": {
"key": "value"
},
"lastOperation": {
"correlationId": "",
"status": "STARTED",
"softwareModule": {
"name": "",
"version": ""
},
"software": {
"group": "",
"name": "",
"version": "",
"type": ""
},
"progress": 0,
"message": "",
"statusCode": ""
},
"lastFailedOperation": {
"correlationId": "",
"status": "STARTED",
"softwareModule": {
"name": "",
"version": ""
},
"software": {
"group": "",
"name": "",
"version": "",
"type": ""
},
"progress": 0,
"message": "",
"statusCode": ""
}
}
}
},
"compass": {
"definition": [
"com.bosch.iot.suite.example.octopussuiteedition:Magnetometer:1.1.0"
],
"properties": {
"status": {
"xValue": 0,
"yValue": 0,
"zValue": 0,
"compassDirection": 0,
"sensorUnits": ""
}
}
},
"display": {
"definition": [
"com.bosch.iot.suite.example:Display:1.0.0"
],
"properties": {
"status": {
"currentText": ""
}
}
},
"led": {
"definition": [
"com.bosch.iot.suite.example:LedLamp:1.0.0"
],
"properties": {
"status": {
"currentColor": {
"r": 0,
"g": 0,
"b": 0
}
}
}
},
"switch": {
"definition": [
"com.bosch.iot.suite.example:Switch:1.0.0"
],
"properties": {
"status": {
"on": false
}
}
},
"geolocation": {
"definition": [
"com.bosch.iot.suite.examples.geolocation:Geolocation:1.0.0"
],
"properties": {
"status": {
"geoposition": {
"latitude": 0,
"longitude": 0
},
"accuracy": 0
}
}
}
}
}