# Streams management
The eKuiper REST api for streams allows you to manage the streams, such as create, describe, show and drop stream definitions.
# create a stream
The API is used for creating a stream. For more detailed information of stream definition, please refer to streams.
POST http://localhost:9081/streams
Copied!
Request sample, the request is a json string with sql
field.
{"sql":"create stream my_stream (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"}
Copied!
This API can run any stream sql statements, not only stream creation.
# show streams
The API is used for displaying all of streams defined in the server.
GET http://localhost:9081/streams
Copied!
Response Sample:
["mystream"]
Copied!
# describe a stream
The API is used for print the detailed definition of stream.
GET http://localhost:9081/streams/{id}}
Copied!
Response Sample:
{ "Name": "demo", "StreamFields": [ { "Name": "temperature", "FieldType": { "Type": 2 } }, { "Name": "ts", "FieldType": { "Type": 1 } } ], "Options": { "DATASOURCE": "demo", "FORMAT": "JSON" } }
Copied!
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Get stream schema
The API is used to get the stream schema. The schema is inferred from the physical and logical schema definitions.
GET http://localhost:9081/streams/{id}/schema
Copied!
The format is like Json schema:
{ "id": { "type": "bigint" }, "name": { "type": "string" }, "age": { "type": "bigint" }, "hobbies": { "type": "struct", "properties": { "indoor": { "type": "array", "items": { "type": "string" } }, "outdoor": { "type": "array", "items": { "type": "string" } } } } }
Copied!
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# update a stream
The API is used for update the stream definition.
PUT http://localhost:9081/streams/{id}
Copied!
Path parameter id
is the id or name of the old stream.
Request sample, the request is a json string with sql
field.
{"sql":"create stream my_stream (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"}
Copied!
# drop a stream
The API is used for drop the stream definition.
DELETE http://localhost:9081/streams/{id}
Copied!
← Authentication Tables →