save_mqtt_topic_config 保存MQTT的Topic配置
POST /api/v1/net_manage/save_mqtt_topic_config
描述
保存MQTT的各类数据的Topic配置,根据传入的topicType参数,返回对应的Topic配置信息,enableSendMsg属性修改后会立即生效,另外2个属性需要设备重启才能生效。
访问权限
具备以下权限:
net_manage:save_mqtt_client_config
请求参数
请求参数如下:
{
"topicType": 1|2,
"enableSendMsg": "enable"|"disable",
"topicName": string,
"queueLength": number
}
提示
- topicType: 数据主题类型,1-操作日志、2-驯钟鉴相值。
- enableSendMsg: 是否启用发送消息,enable表示启用,disable表示不启用,配置后立即生效。
- topicName: MQTT消息发送的Topic名称,重启后生效。
- queueLength: 内部缓存未发送的消息队列长度,重启后生效。
请求示例:
{
"topicType": 1,
"enableSendMsg": "disable",
"topicName": "device_operation_log",
"queueLength": 64
}
响应结果
请求返回的HTTP状态码为200
{
"success": true|false,
"errorCode"?: "option string",
"errorMessage"?: "option string",
"showType"?: 0|1|2|4|9,
"traceId"?: "option string"
}
正确结果示例:
{
"success": true
}
响应结果
请求返回的HTTP状态码为200
{
"success": true|false,
"errorCode"?: "option string",
"errorMessage"?: "option string",
"showType"?: 0|1|2|4|9,
"traceId"?: "option string"
}
正确结果示例:
{
"success": true
}
错误码
| 错误码 | 说明 | 错误信息 | 显示 类型 |
|---|---|---|---|
| 40007 | 请求参数格式错误 | error.request.format | 2 |
| 40007 | 主题类型不能为空 | topic.type.can.not.be.empty | 2 |
| 40007 | 主题类型的值无效 | topic.type.invalid | 2 |
| 40007 | 启动发送消息不能为空 | enable.send.msg.can.not.be.empty | 2 |
| 40007 | 启动发送消息的值必须是enable或disable | enable.send.msg.must.be.enable.or.disable | 2 |
| 40007 | 主题名称不能为空 | topic.name.can.not.be.empty | 2 |
| 40007 | 主题名称长度不能超过128个字符 | topic.name.length.invalid | 2 |
| 40007 | 队列长度不能为空 | queue.length.can.not.be.empty | 2 |
| 40007 | 队列长度必须在1-128之间 | queue.length.must.be.1.to.128 | 2 |
| 40007 | 保存配置异常 | error.saving.config | 2 |