Kafka Admin API

Go to the Service credentials page and View credentials. To access the Kafka Admin API, use the value for property kafka_admin_url. The Swagger 2.0 docs for the IBM Event Streams Administration REST API is found at https://raw.githubusercontent.com/ibm-messaging/event-streams-docs/master/admin-rest-api/admin-rest-api.yaml. You can load the file via URL import in the http://editor.swagger.io, click File > Import URL > OK. Or read the README for the Admin API at https://github.com/ibm-messaging/event-streams-docs/tree/master/admin-rest-api.

To authenticate add an X-Auth-Token HTTP Header with the apikey found in the service credentials.

List the Kafka topics,

$ curl -X GET \
  https://a1bc2d3efg4hijkl.svc01.us-south.eventstreams.cloud.ibm.com/admin/topics \
  -H 'X-Auth-Token: 1abCDEFgHi2jKlmnO3pqrsTU4VwXyzaBcdeFgHiJkLmN'
[
    {
        "name": "greetings",
        "partitions": 1,
        "replicationFactor": 3,
        "retentionMs": 86400000,
        "cleanupPolicy": "delete",
        "configs": {
            "cleanup.policy": "delete",
            "min.insync.replicas": "2",
            "retention.bytes": "104857600",
            "retention.ms": "86400000",
            "segment.bytes": "536870912"
        },
        "replicaAssignments": [
            {
                "id": 0,
                "brokers": {
                    "replicas": [
                        0,
                        1,
                        2
                    ]
                }
            }
        ]
    }
]

Delete a topic,

$ curl -X DELETE \
  https://a1bc2d3efg4hijkl.svc01.us-south.eventstreams.cloud.ibm.com/admin/topics/greetings \
  -H 'X-Auth-Token: 1abCDEFgHi2jKlmnO3pqrsTU4VwXyzaBcdeFgHiJkLmN'

Create a topic,

$ curl -X POST \
  https://a1bc2d3efg4hijkl.svc01.us-south.eventstreams.cloud.ibm.com/admin/topics \
  -H 'X-Auth-Token: 1abCDEFgHi2jKlmnO3pqrsTU4VwXyzaBcdeFgHiJkLmN' \
  -d '{
  "name": "greetings",
  "partitions": 1
}'

Get a topic,

$ curl -X GET \
  https://a1bc2d3efg4hijkl.svc01.us-south.eventstreams.cloud.ibm.com/admin/topics/greetings \
  -H 'X-Auth-Token: 1abCDEFgHi2jKlmnO3pqrsTU4VwXyzaBcdeFgHiJkLmN'

Update a topic configuration,

$ curl -X PATCH \
  https://a1bc2d3efg4hijkl.svc01.us-south.eventstreams.cloud.ibm.com/admin/topics/greetings \
  -H 'X-Auth-Token: 1abCDEFgHi2jKlmnO3pqrsTU4VwXyzaBcdeFgHiJkLmN' \
  -d '{
  "new_total_partition_count": 1
}'

Last updated