liveBook · Manning

REST

As explained in Kafka Streams in Action, Second Edition

A REST API is an HTTP-based interface that exposes resources and operations through conventional web representations and methods.

A REST API gives clients a direct interface to Schema Registry. Producers, consumers, build plugins, and command-line tools send requests while Schema Registry manages schemas outside the Kafka brokers. section 3.2.3

The useful mental model is a request path around a distributed service: every node can serve reads, while secondary nodes forward schema registration and update requests to the primary node. The primary persists changes to Kafka’s compacted schemas topic. section 3.2.3

Common REST API work with Schema Registry includes:

  • Register a schema with a POST request addressed to a subject and version endpoint. section 3.2.5
  • List registered subjects, retrieve all versions for a subject, and retrieve a specific or latest schema version. section 3.2.5
  • Pipe schema content through jq, send requests with curl, and format JSON responses for inspection. section 3.2.4 section 3.2.5

Registering and checking an Avro schema

Prepare an Avro schema as JSON, POST it to `/subjects/avro-avengers-value/versions` with the Schema Registry content type, and inspect the returned identifier. A successful registration returns `{ "id": 1 }`. Then query `/subjects`, `/subjects/avro-avengers-value/versions`, or `/subjects/avro-avengers-value/versions/latest` to discover and inspect the registered schema.

Figure 3.4 Schema Registry is a distributed application where only the primary node communicates with Kafka.
figure

Trace how the primary Schema Registry node communicates with Kafka while clients use the REST API. section 3.2.3

Figure 3.5 All Schema Registry nodes can serve read requests.
figure

Compare the read path, where every Schema Registry node can serve client read requests. section 3.2.3

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains request routing and Kafka-backed persistence, then demonstrates basic curl commands without detailing REST endpoint internals.
Examples
Demonstrates curl and jq commands for registering an Avengers Avro schema and retrieving subjects and versions.
What it assumes
Assumes Schema Registry and schema concepts, while introducing curl, jq, subjects, versions, and assigned schema identifiers.
What you can do after
Apply it via curl and jq to register schemas, list subjects, and retrieve schema versions.
How it connects
Connects REST API to Schema Registry, Kafka, schemas, subjects, schema versions, serializers, and deserializers.

Also explained in

Compare how 22 books explain REST →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.