Register device
Provide users with a device registration method. When device name existed, the interface returns the current device information.
Request Syntax
POST /mqtt/v1/devices/reg
Authorization:xxxx
Content-Type:application/json
{
"name":"IMEI12345678901",
"desc":"some description",
"key":"5h2QzmpEqD7IqaOYNoj2kuNNm1Q="
}
Body Description
Name |
Type |
Required (Y/S) |
Description |
name |
string |
Yes |
Device name, a unique product identifier. It is recommended to use device SN, IMEI or MAC as device name. Only 1-64 letters, numbers, "_" and "-" are allowed. |
desc |
string |
No |
Device description, 0-100 in length |
key |
string |
No |
The format must be base64 encoded, and the source code must not exceed 32 bytes in length. By default, the platform automatically assigns a device key. |
Return Syntax
{
"request_id":"855b2fe4-3f54-41f2-8cd5-3e34bcfa8356",
"code_no":"000000",
"code":"onenet_common_success",
"message":null,
"data":{
"device_id":"12345",
"name":"IMEI12345678901",
"pid":1234,
"key":"5h2QzmpEqD7IqaOYNoj2kuNNm1Q="
}
}
Data Parameter Description
Name |
Type |
Description |
device_id |
string |
Device ID |
name |
string |
Device name |
pid |
int |
Product id |
key |
string |
Device secret key |
More help
Scan the error codes returned by API