简体   繁体   中英

How to create a device in IoT Hub via REST API or SDK

I want to create a device in the IoT Hub when I add a device in my application.

I'm looking for REST Endpoints available for performing operation. Or any SDK available to do this.

Have a look at the following docs:

Service - Create Or Update Device

Control access to IoT Hub

example of the creating DeviceX with auto-generated symmetric keys:

PUT https://myIoTHubName.azure-devices.net/devices/DeviceX?api-version=2018-06-30

headers:

Authorization: sasToken(see the above link)

payload:

{
  "deviceId": "DeviceX"
}

Here you can find an example of how to using ServiceClient JAVA SDK. For connection string, you can use IoT Hub Owner from shared access policies. If you want a more restrictive approach, make sure you select only registry read and write for this operation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM