With curl commands, schemas can be retrieved/updated to Confluent SchemaRegistry.

Get the latest schema available on the topic:

curl -X GET http://localhost:8081/subjects/testtopic-value/versions/latest

Get Schema compatibility:

curl -X GET http://localhost:8081/config/testtopic-value

Get versions of all registered schemas on a topic:

curl -X GET http://localhost:8081/subjects/testtopic-value/versions

[1,2,3]

List all subjects – registered schemas on topics:

curl -X GET http://localhost:8081/subjects

Check compatibility of a message against a registered schema

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
--data '{"schema": "{\"type\": \"string\"}"}' \
http://localhost:8081/compatibility/subjects/testtopic-value/versions/latest

Update Schema compatibility

curl -X PUT -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"compatibility": "BACKWARD"}' http://localhost:8081/config/testtopic-value


curl -X PUT -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"compatibility": "NONE"}' http://localhost:8081/config/testtopic-value

Post a Schema

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema": "{\"type\": \"int\"}"}' http://localhost:8081/subjects/testtopic-value/versions

With a file :

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" --data @test1.avsc http://localhost:8082/subjects/testtopic-value/versions


curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
--data '{"schema": "{ \"namespace\": \"emp3.avro\", \"type\": \"record\", \"name\": \"Emp1\", \"fields\": [ { \"type\": \"int\", \"name\": \"empid\" } , { \"type\": \"string\", \"name\": \"empname\" }, { \"type\": \"string\", \"name\": \"address\" } ] }" }' \
http://localhost:5081/subjects/testtopic-value/versions



Leave a Reply

Your email address will not be published. Required fields are marked *