Update device key
Provide users with a device key update and customization method.
Request Syntax
PUT /mqtt/v1/devices/{device_id}/key?force_offline=true
Authorization:xxxx
Content-Type:application/json
{
"key":"5h2QzmpEqD7IqaOYNoj2kuNNm1Q="
}
URL Parameter Description
Name |
Type |
Required (Y/S) |
Description |
force_offline |
bool |
No |
Is the device forced to go offline? It is true by default, that is, with this parameter, the device will go offline if the update is successful. |
Body Description
Name |
Type |
Required (Y/S) |
Description |
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 new 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 |
New device key |
More help
Scan the error codes returned by API