| 字段 | JSON 键名 | 类型 | 验证规则 | 描述 |
|---|---|---|---|---|
| Host | host | string | required, max=255 | 主机名/IP |
| Port | port | int | required, min=1, max=65535 | 端口 |
| Topic | topic | string | required, max=255 | 发布Topic |
| QoS | qos | int | min=0, max=2 | QoS |
| MQTTVersion | mqtt_version | string | required, max=10 | MQTT Version |
| ClientID | client_id | *string | omitempty, max=255 | Clinet ID (可选) |
| Username | username | *string | omitempty, max=128 | 用户名 (可选) |
| Password | password | *string | omitempty, max=128 | 密码 (可选) |
| 字段 | JSON 键名 | 类型 | 验证规则 | 描述 |
|---|---|---|---|---|
| URL | url | string | required, url | URL地址 |
| EnableHMAC | enable_hmac | bool | - | 是否启用消息加密 |
| Secret | secret | *string | required_if=EnableHMAC true, min=8, max=128, alphanum | Secret密钥 |
{
"name": "MQTT Broker Alpha",
"forwarding_rule_id": "rule123456",
"type": 1,
"description": "Primary MQTT broker for data forwarding",
"config": {}
}curl --location --request POST '/api/v1/forwarding/target' \
--header 'x-token: {{x-token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "MQTT Broker Alpha",
"forwarding_rule_id": "rule123456",
"type": 1,
"description": "Primary MQTT broker for data forwarding",
"config": {}
}'{"code":200,"message":"转发目标配置创建成功","data":{"id":"62c158dc-0d3e-aeac-9bff-f53b3628da6f","name":"MQTT Broker Alpha","forwarding_rule_id":"9b9404fb-c1d5-645a-17f3-4bc83b580fbb","type":1,"description":"Primary MQTT broker for data forwarding","config":{"broker":"mqtt.example.com","port":1883,"client_id":"forwarder_client_001","username":"mqtt_user","password":"mqtt_password","topic":"data/forwarded","qos":1,"retain":false,"use_ssl":false},"created_at":"2024-10-18T16:45:39.406049+08:00","updated_at":"2024-10-18T16:45:39.406049+08:00"}}