eKuiper REST api 允许您管理模式,例如创建、删除和列出模式。
该API接受JSON内容以创建新的模式。 每种模式类型都有一个独立的端点。当前模式类型仅有一种 protobuf
。模式由名称标识。名称必须唯一。
POST http://localhost:9081/schemas/protobuf
模式内容在请求体上的请求示例:
{
"name": "schema1",
"content": "message Book {required string title = 1; required int32 price = 2;}"
}
模式内容在文件上的请求示例:
{
"name": "schema2",
"file": "file:///tmp/ekuiper/internal/schema/test/test2.proto"
}
模式包含静态插件示例:
{
"name": "schema2",
"file": "file:///tmp/ekuiper/internal/schema/test/test2.proto",
"soFile": "file:///tmp/ekuiper/internal/schema/test/so.proto"
}
data/schemas/$shcema_type/$schema_name
文件中。
该 API 用于显示服务器中为模式类型定义的所有模式。
GET http://localhost:9081/schemas/protobuf
响应示例:
["schema1","schema2"]
该 API 用于打印模式的详细定义。
GET http://localhost:9081/schemas/protobuf/{name}
路径参数 name
是模式的名称。
响应示例:
{
"type": "protobuf",
"name": "schema1",
"content": "message Book {required string title = 1; required int32 price = 2;}",
"file": "ekuiper\\etc\\schemas\\protobuf\\schema1.proto"
}
该 API 用于删除模式。
DELETE http://localhost:9081/schemas/protobuf/{name}
该 API 用于修改模式,其消息体格式与创建时相同。
PUT http://localhost:9081/schemas/protobuf/{name}
{
"name": "schema2",
"file": "http://ahot.com/test2.proto"
}