iot/docs/endpoint.md
2023-07-24 11:26:46 +08:00

59 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Endpoint管理
### 获取全部的Endpoint
```html
method: GET
url: /endpoint/all
返回数据:
[
{
"name": "名称",
"title": "中电集团"
"matcher": "匹配的正则表达式",
"protocol": "http|https|websocket|mqtt|kafka",
"config": "参考config格式说明"
}
]
```
### 创建Endpoint
```html
method: POST
url: /endpoint/create
body: (content-type: application/json)
{"name": $name, "matcher": $matcher, "title": $title, "protocol": "http|https|websocket|kafka|mqtt", "config": "参考config格式说明"}
说明:
name是唯一的不同的终端名称代表不同的接受端
```
### 删除Endpoint
```html
method: POST
url: /endpoint/delete
body: (content-type: application/json)
{"name": $name}
```
### config格式说明
```html
http|https
{"url": "http(s)://xx.com"}
websocket
{"url": "ws://xx.com/ws"}
kafka:
{"bootstrap_server": ["localhost:9092"], "topic": "test", "username": "test", "password": "password1234"}
mqtt:
{"host": "localhost", port: 1883, "username": "test", "password": "test1234", "topic": "CET/NX/${location_code}/upload", "qos": 0|1|2}
topic中支持预定义变量: ${location_code}; 发送的时候会替换成对应的点位编码
```