跳到主要内容

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.format2
40007主题类型不能为空topic.type.can.not.be.empty2
40007主题类型的值无效topic.type.invalid2
40007启动发送消息不能为空enable.send.msg.can.not.be.empty2
40007启动发送消息的值必须是enable或disableenable.send.msg.must.be.enable.or.disable2
40007主题名称不能为空topic.name.can.not.be.empty2
40007主题名称长度不能超过128个字符topic.name.length.invalid2
40007队列长度不能为空queue.length.can.not.be.empty2
40007队列长度必须在1-128之间queue.length.must.be.1.to.1282
40007保存配置异常error.saving.config2