The eKuiper REST api for schemas allows you to manage schemas, such as create, show, drop and describe schemas.

# Create a schema

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
1

Schema content inside request body:

{
  "name": "schema1",
  "content": "message Book {required string title = 1; required int32 price = 2;}"
}
1
2
3
4

Schema content in a file:

{
  "name": "schema2",
  "file": "file:///tmp/ekuiper/internal/schema/test/test2.proto"
}
1
2
3
4

Schema with static plugin:

{
  "name": "schema2",
  "file": "file:///tmp/ekuiper/internal/schema/test/test2.proto",
   "soFile": "file:///tmp/ekuiper/internal/schema/test/so.proto"
}
1
2
3
4
5

# Parameters

  1. name:the unique name of the schema.
  2. schema content, use file or content parameter to specify. After schema created, the schema content will be written into file data/schemas/$shcema_type/$schema_name.
    • file: the url of the schema file. The url can be 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.
    • content: the text content of the schema.
  3. soFile:The so file of the static plugin. Detail about the plugin creation, please check customize format.

# Show schemas

The API is used for displaying all schemas defined in the server.

GET http://localhost:9081/schemas/protobuf
1

Response Sample:

["schema1","schema2"]
1

# Describe a schema

The API is used for print the detailed definition of a schema.

GET http://localhost:9081/schemas/protobuf/{name}
1

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"
}
1
2
3
4
5
6

# Delete a schema

The API is used for dropping the schema.

DELETE http://localhost:9081/schemas/protobuf/{name}
1

# Update a schema

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"
}
1
2
3
4
5
6