The eKuiper REST api for schemas allows you to manage schemas, such as create, show, drop and describe schemas.
The API accepts a JSON content and create a schema. Each schema type has a standalone endpoint. Currently, only one schema type protobuf
is supported. Schema is identified by its name, so the name must be unique for each type.
POST http://localhost:9081/schemas/protobuf
Schema content inside request body:
{
"name": "schema1",
"content": "message Book {required string title = 1; required int32 price = 2;}"
}
Schema content in a file:
{
"name": "schema2",
"file": "file:///tmp/ekuiper/internal/schema/test/test2.proto"
}
Schema with static plugin:
{
"name": "schema2",
"file": "file:///tmp/ekuiper/internal/schema/test/test2.proto",
"soFile": "file:///tmp/ekuiper/internal/schema/test/so.proto"
}
file
or content
parameter to specify. After schema created, the schema content will be written into file data/schemas/$shcema_type/$schema_name
.
http
or https
scheme or file
scheme to refer to a local file path of the eKuiper server. The schema file must be the file type of the corresponding schema type. For example, protobuf schema file's extension name must be .proto.The API is used for displaying all schemas defined in the server.
GET http://localhost:9081/schemas/protobuf
Response Sample:
["schema1","schema2"]
The API is used for print the detailed definition of a schema.
GET http://localhost:9081/schemas/protobuf/{name}
Path parameter name
is name of the schema.
Response Sample:
{
"type": "protobuf",
"name": "schema1",
"content": "message Book {required string title = 1; required int32 price = 2;}",
"file": "ekuiper\\etc\\schemas\\protobuf\\schema1.proto"
}
The API is used for dropping the schema.
DELETE http://localhost:9081/schemas/protobuf/{name}
The API is used for updating the schema. The request body is the same as creating a schema.
PUT http://localhost:9081/schemas/protobuf/{name}
{
"name": "schema2",
"file": "http://ahot.com/test2.proto"
}