2021-05-31 - Device Provisioning API update
The Device Provisioning API v1 has been improved to allow referencing a GitHub repository hosting predefined models, from where we can derive a thing structure.
This is achieved by offering a new optional parameter definitionResolver, which replaces the deprecated skipVorto parameter.
The offering at https://vorto.eclipseprojects.io/#/ will be discontinued.
Migrate your models to https://github.com/eclipse/vorto/tree/development/models until June 30, 2021.
Example
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
Activate the new parameter definitionResolver to "vorto".
The request body might look like in the following snippet:
{
"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"
}
}
}
}
Upon success you will get status code 201, the JSON result aggregated from Bosch IoT Hub and Bosch IoT Things, as well as various response headers.
{
"id"
:
"my.demo.namespace:my-device-4711"
,
"hub"
: {
"credentials"
: {
"tenantId"
:
"xxx_hub"
,
"type"
:
"hashed-password"
,
"enabled"
:
true
,
"secrets"
: [
{
"passwordBase64"
:
"xxx"
}
],
"deviceId"
:
"my.demo.namespace:my-device-4711"
,
"authId"
:
"my.demo.namespace_my-device-4711"
,
"adapters"
: [
{...}
]
},
"device"
: {
"enabled"
:
true
,
"deviceId"
:
"my.demo.namespace:my-device-4711"
}
},
"things"
: {
"thing"
: {
"definition"
:
"com.bosch.iot.suite.example:VirtualDemoDevice:2.0.0"
,
"attributes"
: {
...
}
},
"features"
: {
"compass"
: {
"definition"
: [
"com.bosch.iot.suite.example.octopussuiteedition:Magnetometer:1.1.0"
],
"properties"
: {
"status"
: {
"xValue"
:
0
,
"yValue"
:
0
,
"zValue"
:
0
,
"compassDirection"
:
0
,
"sensorUnits"
:
""
}
}
},
"switch"
: {
"definition"
: [
"com.bosch.iot.suite.example:Switch:1.0.0"
],
"properties"
: {
"status"
: {
"on"
:
false
}
}
},
"led"
: {
"definition"
: [
"com.bosch.iot.suite.example:LedLamp:1.0.0"
],
"properties"
: {
"status"
: {
"currentColor"
: {
"r"
:
0
,
"g"
:
0
,
"b"
:
0
}
}
}
},
"display"
: {
"definition"
: [
"com.bosch.iot.suite.example:Display:1.0.0"
],
"properties"
: {
"status"
: {
"currentText"
:
""
}
}
},
"geolocation"
: {
"definition"
: [
"com.bosch.iot.suite.examples.geolocation:Geolocation:1.0.0"
],
"properties"
: {
"status"
: {
"geoposition"
: {
"latitude"
:
0
,
"longitude"
:
0
},
"accuracy"
:
0
}
}
},
"softwareUpdates"
: {
"definition"
: [
"org.eclipse.hawkbit.swupdatable:SoftwareUpdatable:2.0.0"
],
"properties"
: {
"status"
: {
"softwareModuleType"
:
"DemoUpdate"
}
}
}
},
"thingId"
:
"my.demo.namespace:my-device-4711"
,
"policyId"
:
"my.demo.namespace:my-device-4711"
,
"_policy"
: {
...
}
}
}
}
All the features are created based on the model referenced in the definition.