Creating an Update

Overview

This workflow covers the following steps:

  • create a Software Module
  • upload an Artifact
  • create a Distribution Set
  • assign a Software Module to a Distribution Set

Provisioning a Device Updating a Single Device

Introduction

As the device is registered with Bosch IoT Rollouts, we can create the update we want to install on the device. An update (cf. Software Content Definition) can either be created using the Management UI or the Management API.

Via Management UI

Start creating an update by switching to the Upload view in the navigation and create your first Software Module of type OS by clicking on the icon. In a next step, you can upload one or multiples files (a.k.a. Artifacts) into your module. Now, a Distribution Set is required to package your module. Therefore, go to the Distributions view in the navigation, click on the icon and choose type OS ONLY. In a final step, you have to assign your Software Module to your Distribution Set by drag’n drop the former on the latter.

Creating an Update in UI

Via Management API

Creating an update via the Management API requires four calls:

1: Create a Software Module

We start by creating a Software Module. The respective replacement tokens are explained here.

$ curl 'https://<HOST>/rest/v1/softwaremodules' -u "<TENANT_ID>\<USERNAME>:<PASSWORD>" -i -X POST -H 'Content-Type: application/json;charset=UTF-8' -d'[{
   "vendor" : "Example Ltd.",
   "name" : "myOs",
   "description" : "First version of MyOS.",
   "type" : "os",
   "version" : "1.0"
}]'
  
[
  {
    "createdBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
    "createdAt": 1530539254263,
    "lastModifiedBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
    "lastModifiedAt": 1530539254263,
    "name": "myOs",
    "description": "First version of MyOS.",
    "version": "1.0",
    "type": "os",
    "vendor": "Example Ltd.",
    "deleted": false,
    "_links": {
      "self": {
        "href": "https://<HOST>/rest/v1/softwaremodules/1500"
      }
    },
    "id": 1500
  }
]

2: Upload an Artifact

Now we can upload files to our newly created Software Module (SM_ID=1500). You can take any file you want or create a demo file by running the following command in your terminal echo "This is a test update file." > example.file.

$ curl 'https://<HOST>/rest/v1/softwaremodules/<SM_ID>/artifacts' -u "<TENANT_ID>\<USERNAME>:<PASSWORD>" -i -X POST -H 'Content-Type: multipart/form-data' -F 'file=@example.file'

{
  "createdBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
  "createdAt": 1530539803637,
  "lastModifiedBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
  "lastModifiedAt": 1530539803637,
  "hashes": {
    "sha1": "d2e7291c2c52b87b2ee00983217e1bcc0909251f",
    "md5": "b14f29fe8cea6b25e62a8e5c48b5a3a1"
  },
  "providedFilename": "example.file",
  "size": 28,
  "_links": {
    "self": {
      "href": "https://<HOST>/rest/v1/softwaremodules/1500/artifacts/335"
    },
    "download": {
      "href": "https://api.eu1.bosch-iot-rollouts.com/rest/v1/softwaremodules/1500/artifacts/335/download"
    }
  },
  "id": 335
}

3: Create a Distribution Set

In a third step we have to create a Distribution Set which can be rolled out to a device.

$ curl 'https://<HOST>/rest/v1/distributionsets' -u "<TENANT_ID>\<USERNAME>:<PASSWORD>" -i -X POST -H 'Content-Type: application/json;charset=UTF-8' -d'[{
   "requiredMigrationStep": false,
   "name": "myOs-ds",
   "description": "MyOS initial update",
   "type": "os",
   "version": "1.0",
   "modules": [
     {
       "id": 1500
     }
   ]
}]'

[
  {
    "createdBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
    "createdAt": 1530540407559,
    "lastModifiedBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
    "lastModifiedAt": 1530540407559,
    "name": "myOs-ds",
    "description": "MyOS initial update",
    "version": "1.0",
    "modules": [
      {
        "createdBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
        "createdAt": 1530539254263,
        "lastModifiedBy": "CLD:83717175-0650-400a-b6f2-9a4a398fc07a",
        "lastModifiedAt": 1530539803644,
        "name": "myOs",
        "description": "First version of MyOS.",
        "version": "1.0",
        "type": "os",
        "vendor": "Example Ltd.",
        "deleted": false,
        "_links": {
          "self": {
            "href": "https://<HOST>/rest/v1/softwaremodules/1500"
          }
        },
        "id": 1500
      }
    ],
    "requiredMigrationStep": false,
    "type": "os",
    "complete": true,
    "deleted": false,
    "_links": {
      "self": {
        "href": "https://<HOST>/rest/v1/distributionsets/2829"
      }
    },
    "id": 2829
  }
]

4: Assign the Software Module to Distribution Set

Finally, we have to assign the Software Module (SM_ID=1500), containing our update, to the Distribution Set (DS_ID=2829).

$ curl 'https://<HOST>/rest/v1/distributionsets/<DS_ID>/assignedSM' -u "<TENANT_ID>\<USERNAME>:<PASSWORD>" -i -X POST -H 'Content-Type: application/json;charset=UTF-8' -d '[{
   "id": <SM_ID>
}]'

Provisioning a device [Top ] Updating a device