API reference

Producing messages

Creates a topic

POST http://streams.token-project.eu:8080/topics/topic

Creates a topic.

Headers

NameTypeDescription

Content-Type*

string

application/json

Authorization*

string

Bearer: $TOKEN

Request Body

NameTypeDescription

topic_name*

string

The topic name

{
    "message": "created"
}
curl -L -X POST 'http://streams.token-project.eu:8080/streams/topics/topic' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $TOKEN' \
--data-raw '{"topic_name": "example"}'

Produces JSON messages to a topic

POST http://streams.token-project.eu:8080/streams/topic/topic_name

Produces JSON messages to a topic

Headers

NameTypeDescription

Content-Type*

string

application/vnd.kafka.json.v2+json

Authorization*

string

Bearer: $TOKEN

Request Body

NameTypeDescription

records*

Array

Array of JSON Objects

{
    "offsets": [
        {
            "offset": 1,
            "partition": 0
        }
    ]
}
curl -L -X POST 'http://streams.token-project.eu:8080/streams/consumers/my_consumer' \
-H 'Content-Type: application/vnd.kafka.json.v2+json' \
-H 'Authorization: Bearer $TOKEN' \
--data-raw '{
    "records": [
        {
            "key":"key",
            "value": {
                "foo": "bar"
            }
        }
    ]
}'

Consuming messages

Creates a new consumer instance

POST http://streams.token-project.eu:8080/streams/consumers/consumer_group

Creates a new consumer.

Headers

NameTypeDescription

Content-Type*

string

application/vnd.kafka.json.v2+json

Accept*

string

application/vnd.kafka.json.v2+json

Authorization*

string

Bearer: $TOKEN

Request Body

NameTypeDescription

auto.offset.reset

string

Sets the auto.offset.reset setting for the consumer

{
    "base_uri": "http://streams.token-project.eu:8080/streams/consumers/my_consumer/instances/33707dcc-022d-476e-b8bc-28d0ae2fbb35",
    "instance_id": "33707dcc-022d-476e-b8bc-28d0ae2fbb35"
}
curl -L -X POST 'http://streams.token-project.eu:8080/streams/consumers/consumer_group' \
-H 'Content-Type: application/vnd.kafka.json.v2+json' \
-H 'Accept: application/vnd.kafka.json.v2+json' \
-H 'Authorization: Bearer $TOKEN' \
--data-raw '{"auto.offset.reset": "earliest"}'

Subscribes the consumer to a topic

POST http://streams.token-project.eu:8080streams/consumers/consumer_group/instances/2eb4ab23-0771-496d-8731-510772c454ab/subscription

Subscribes the consumer to a topic

Headers

NameTypeDescription

Content-Type*

string

application/vnd.kafka.json.v2+json

Authorization*

string

Bearer: $TOKEN

Request Body

NameTypeDescription

topics*

Array

Array of topics to subscribe to

Empty response
curl -L -X POST 'http://streams.token-project.eu:8080/streams/consumers/consumer_group/instances/2eb4ab23-0771-496d-8731-510772c454ab/subscription' \
-H 'Content-Type: application/vnd.kafka.json.v2+json' \
-H 'Authorization: Bearer $TOKEN' \
--data-raw '{"topics":["messaging"]}'

Consumes messages from a topic

GET http://streams.token-project.eu:8080streams/consumers/consumer_group/instances/2eb4ab23-0771-496d-8731-510772c454ab/records

Consumes messages from a topic

Headers

NameTypeDescription

Accept*

string

application/vnd.kafka.json.v2+json

Authorization*

string

Bearer: $TOKEN

[
  {
    "topic": "topic_name",
    "key":"key",
    "value": {
        "foo": "bar"
    },
    "partition": 0,
    "offset": 0
  },
  {
    "topic": "topic_name",
    "key":"key_1",
    "value": {
        "foo": "bar"
    },
    "partition": 0,
    "offset": 1
  },
  {
    "topic": "topic_name",
    "key":"key_2",
    "value": {
        "foo": "bar"
    },
    "partition": 0,
    "offset": 2
  }
]
curl -L -X GET 'http://streams.token-project.eu:8080/streams/consumers/consumer_group/instances/2eb4ab23-0771-496d-8731-510772c454ab/records' \
-H 'Accept: application/vnd.kafka.json.v2+json' \
-H 'Authorization: Bearer $TOKEN' \
--data-raw '{"topics":["messaging"]}'

Last updated