streams.md 1.4 KB

Streams management

The Kuiper 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

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\")"}

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

Response Sample:

["mystream"]

describe a stream

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

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

Response Sample:

{
  "Name": "demo",
  "StreamFields": [
    {
      "Name": "temperature",
      "FieldType": {
        "Type": 2
      }
    },
    {
      "Name": "ts",
      "FieldType": {
        "Type": 1
      }
    }
  ],
  "Options": {
    "DATASOURCE": "demo",
    "FORMAT": "JSON"
  }
}

drop a stream

The API is used for drop the stream definition.

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