新建设备后,使用此接口设置MQTT认证配置。设置后需要应用才能生效。
请求接口
PUT /api/device-instance/{id}
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| X-Access-Token | header | string | 是 | 平台 token |
| body | body | object | 是 | - |
| » id | body | string | 是 | ID |
| » configuration | body | object | 是 | 配置信息 |
| »» secureId | body | string | 是 | MQTT密钥ID |
| »» secureKey | body | string | 是 | MQTT密钥Key |
响应参数
以200 Response为例,响应参数如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 |
|---|---|---|---|---|
| » message | string | true | none | 返回信息 |
| » result | object | true | none | 返回结果 |
| » status | integer | true | none | 响应状态码 |
| » timestamp | integer | true | none | 时间戳 |
响应状态码
| 状态码 | 状态码含义 | 说明 |
|---|---|---|
| 200 | OK | 成功 |
| 401 | Unauthorized | 登录状态已过期,token不能为空 |
| 500 | Internal Server Error | 服务器内部异常 |
Body示例
json
{
"id":"mqtt",
"configuration":{
"secureId":"123",
"secureKey":"123"
}
}{
"id":"mqtt",
"configuration":{
"secureId":"123",
"secureKey":"123"
}
}返回示例
以200 Response为例:
json
{
"message":"success",
"result":true,
"status":200,
"timestamp":1693552949192
}{
"message":"success",
"result":true,
"status":200,
"timestamp":1693552949192
}