'how to properly register Protobuf schema with Schema Registry / Kafka-Rest
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?
Solution 1:[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; }\"}"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | feroze |
