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.

  1. POST http://localhost:9081/streams

Request sample, the request is a json string with sql field.

  1. {"sql":"create stream my_stream (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"}

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.

  1. GET http://localhost:9081/streams

Response Sample:

  1. ["mystream"]

describe a stream

The API is used for print the detailed definition of stream.

  1. GET http://localhost:9081/streams/{id}}

Response Sample:

  1. {
  2. "Name": "demo",
  3. "StreamFields": [
  4. {
  5. "Name": "temperature",
  6. "FieldType": {
  7. "Type": 2
  8. }
  9. },
  10. {
  11. "Name": "ts",
  12. "FieldType": {
  13. "Type": 1
  14. }
  15. }
  16. ],
  17. "Options": {
  18. "DATASOURCE": "demo",
  19. "FORMAT": "JSON"
  20. }
  21. }

update a stream

The API is used for update the stream definition.

  1. PUT http://localhost:9081/streams/{id}

Path parameter id is the id or name of the old stream.

Request sample, the request is a json string with sql field.

  1. {"sql":"create stream my_stream (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"}

drop a stream

The API is used for drop the stream definition.

  1. DELETE http://localhost:9081/streams/{id}