2

I am following this documentation. I am able to get cluster's information like this:

curl -sk -X GET "https://xx.xx.xx.xx:8443/v3/clusters/"

the previous request works fine. However, when I try to create a topic I get HTTP 415 Unsupported Media Type javax.ws.rs.NotSupportedException error

command:

curl -sk -X POST \
     -H "Content-Type: application/json" \
     -d "{\"topic_name\":\"test1\",\"partitions_count\":6,\"replication_factor\":3,\"configs\":[]}" \
     "https://xx.xx.xx.xx:8443/v3/clusters/xxxxxxx/topics"

does anyone have an idea on how to solve this issue?

roAl
  • 173
  • 1
  • 1
  • 16

2 Answers2

2

I had the same issue, this worked for me.

curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json"
--data '{"records":[{"value":{"foo":"bar"}}]}' "https://localhost:8443/topics/test"
1

The example from this blog post worked for me:

POST http://localhost:8443/v3/clusters/<CLUSTER_ID>/topics
Content-Type: application/vnd.api+json

{
  "data": {
    "attributes": {
      "topic_name": "topic",
      "partitions_count": 1,
      "replication_factor": 2,
      "configs": []
    }
  }
}

So changing the Content-Type to application/vnd.api+json and using a different request body

Karim Darwish
  • 11
  • 1
  • 1