我正试图使用kafka-rest接口将Protobuf架构发布到架构注册表:
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"
我得到这个错误:
{"error_code":415,"message":"HTTP 415 Unsupported Media Type"}
问题:指示媒体类型的正确方式是什么?
您需要在JSON信封中发送它,因为它不是avro模式。
$ 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; }"}"