remkohdev
  • Learn to Code
  • About Me
  • CI/CD
    • DevOps101
      • Welcome
  • OpenShift
    • Setup OpenShift
      • Setup Minishift
    • Builds
      • Source-to-Image (S2I)
        • Setup S2I
        • Build, Run, Deploy from Source
      • Jenkins Pipeline
    • Jenkins as a Service
      • Setup Jenkins on Openshift
      • Create a Pipeline for Java Spring Boot
  • Istio
    • Setup Istio on IKS
      • Login to IKS
    • Setup Istio on Openshift 3.11
    • Traffic Shifts with a VirtualService
    • Telemetry of Metrics using Prometheus
    • Telemetry of Distributed Tracing using Jaeger
    • Security with Mutual TLS (mTLS)
  • Apache Kafka
    • Setup Apache Kafka on IBM Cloud
    • Setup Apache Kafka on OpenShift
    • Produce and Consume Streams with Kafka Console Tools
    • Produce and Consume Streams with Spring Boot
    • Using the Event Streams CLI
    • Kafka Admin API
  • API Connect
    • APIC CLI
      • Manage API Lifecycle with apic
    • Securing your API
      • Setup AppID
      • Setup API Connect
      • Optional: Add Node-RED Test Server
      • Add 3rd Party OAuth OIDC
        • Create a Custom AppID API
        • Add a Security Definition to your API
Powered by GitBook
On this page

Was this helpful?

  1. Apache Kafka

Kafka Admin API

PreviousUsing the Event Streams CLINextAPIC CLI

Last updated 5 years ago

Was this helpful?

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 . You can load the file via URL import in the , click File > Import URL > OK. Or read the README for the Admin API at .

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
}'

https://raw.githubusercontent.com/ibm-messaging/event-streams-docs/master/admin-rest-api/admin-rest-api.yaml
http://editor.swagger.io
https://github.com/ibm-messaging/event-streams-docs/tree/master/admin-rest-api