Programmatically declare a parent-child relationship between the devices in IoT Hub using Node SDK

245 Views Asked by At

Using the Node SDK, I have programmatically created devices in IoT Hub. I wish to know if the Node SDK provides me the capability to set a device as a child of another device.

Looking at the documentation, I didn't find a way (using SDK). Is there any other way to achieve the same ?

1

There are 1 best solutions below

2
Dominic Betts On BEST ANSWER

As far as I can see and as you found, the SDK doesn't let you create parent/child relationships for devices (https://learn.microsoft.com/javascript/api/azure-iothub/devicescreateorupdateidentityoptionalparams?view=azure-node-latest).

However, the REST API does support this using the deviceScope parameter (https://learn.microsoft.com/en-us/rest/api/iothub/service/devices/create-or-update-identity).

You might find more information here: How to programmatically set a parent device while creating an Azure IoT Hub device?