Examples of interacting with Schema Registry
Learn about different ways of interacting with Schema Registry.
Schema Registry UI
Schema Registry API
You can access the Schema Registry API swagger directly from the UI.
To do this, you need to append your URL with /swagger/
. For example:
https://localhost:7790/swagger/
.
For example, you can create a schema by using Swagger, as shown in the following steps:
- Navigate to the Swagger UI:
http:<sr-host>:<sr-port>/swagger/
- Go to the Schema section and open POST /api/v1/schemaregistry/schemas.
- Click Try it out.
- Enter the input for your schema in the body field.
There is already an example input in the body. You can also edit it.
- Click Execute.
After the successful execution of the command, you see the newly created schema in you Schema Registry UI
For more information about the tasks you can perform through Swagger, see Cloudera Schema Registry REST API Reference.
Java client
You can review the following GitHub repositories for examples of how to interact with the Schema Registry Java client:
Java and Scala
See the following examples of using schema related API:
https://github.com/hortonworks/registry/blob/HDF-2.1.0.0/schema-registry/README.md
Kafka SerDes
See the following example of using the Schema Registry Kafka SerDes:
value.serializer=com.hortonworks.registries.schemaregistry.serdes.json.kafka.KafkaJsonSerial
value.deserializer=com.hortonworks.registries.schemaregistry.serdes.json.kafka.KafkaJsonDeserializer
Jackson 2 is used for serialization, so any Java object which can be processed with this library is also going to be processed by Schema Registry.
.NET client
See the following examples of interacting with the Schema Registry .NET client: