ibm-cloudmessage-hub

Create topic in Message-Hub via curl command


I am trying to create a topic in Message-Hub using a curl command.
I followed this yaml: https://github.com/ibm-messaging/message-hub-docs/blob/master/kafka-administration-api/KafkaTopicManagement.yaml

I'm getting HTTP 405 Method Not Allowed when running the following: curl -X POST --tlsv1.2 -vk -H "Content-Type: application/vnd.kafka.binary.v1+json" -H "X-Auth-Token: apikey from the environment variable of my app" https://kafka-rest-prod01.messagehub.services.us-south.bluemix.net/topics -d "{ \"TopicCreateParam\" { \"name\": \"my.test\" }}"

Thanks for any help.


Solution

  • @jd76 three problems here:

    1. your URL is missing the /admin/ path
    2. your content-type should just be plain json
    3. TopicCreateParam is just the name of the type in the swagger yml.

    Try:

    curl -H "Content-Type: application/json" -H "X-Auth-Token: apikey from the environment variable of my app" -d "{ \"name\": \"my.test\" }" https://kafka-rest-prod01.messagehub.services.us-south.bluemix.net/admin/topics