Search code examples
apache-kafkaavroconfluent-schema-registry

Add New Schema/Subject to Schema Registry in Kafka Avro file format


I am trying to run schema to a schema registry by explicit curl command.

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json"  --data '{"schema" : {"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'  http://localhost:8081/subjects/avro-test/versions/

I am getting the below error {"error_code":500,"message":"Internal Server Error"}

Note : I am able to access the data from the existing subject but getting the same error while pushing it.


Solution

  • The schema needs to be string escaped

    For example, starting out

    POST -d'{"schema": {\"type\":\"record\" 
    

    If you can, then installing jq tool and create an AVSC file instead, that would help - see my comment here