Adding a new device

Adding the device should be by using the same /iiot/devices/ endpoint but, by using the HTTP POST method, we can add a new device to the list of devices, and, if it is successfully created, it should return an HTTP 201 Created status code. This can be seen in the following example:

HTTP POST --> /iiot/devices{      "name": "device-pump2",      "assetType": "pump",      "active": "yes"    } 

HTTP response will be as follows:

201 Created

In this case, the payload does not have the device-ID since it will be autogenerated by the service itself.

Once the device is added, we can actually get the details of the device using a nested URL with the ID by accessing the url/iiot/devices/11. It should return the device details only for that device. ...

Get Industrial Internet Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.