5

I am trying to post a Protobuf schema to the Schema Registry using kafka-rest interface:

curl -X POST -H "Content-Type: application/vnd.kafka.protobuf.v2+json" \
   -H "Accept: application/vnd.kafka.v2+json" \
   --data '{"value_schema": "syntax=\"proto3\"; message User { string name = 1; }", "records": [{"value": {"name": "testUser"}}]}' \
   "http://localhost:8082/topics/protobuftest"

I am getting this error:

{"error_code":415,"message":"HTTP 415 Unsupported Media Type"}

Question: what is the proper way to indicate the media type for this to work?

Eugene Goldberg
  • 14,286
  • 20
  • 94
  • 167

1 Answers1

1

You need to send it in a JSON envelope, since it is not an avro schema.

$ curl -X POST -H "content-type: application/json" 
http://localhost:8081/subjects/protobuf/versions 
-d "{\"schemaType\": \"PROTOBUF\", \"schema\": \"syntax = \\\"proto3\\\";message test { int32 id = 1; }\"}"
feroze
  • 7,380
  • 7
  • 40
  • 57