Skip to main content
This feature is in preview from Gateway 3.23.0. It’s disabled by default and its request and response format can change between releases. Send Kafka records to a topic with an HTTP POST to Gateway’s records API, without a Kafka client. Gateway produces each record as the caller, so the same authentication, ACLs, Virtual Cluster and Interceptors apply as for any other Kafka client connecting to Gateway.

Before you start

  • GATEWAY_FEATURE_FLAGS_RECORDS_API set to true.
  • Access to the records API listener, on port 8889 by default.
  • A SASL_PLAINTEXT listener on Gateway. Gateway produces as the caller through this listener.
  • SASL/PLAIN credentials for the caller.
The requirements explain each of these and what Gateway checks on startup.

Produce a record

1

Get credentials

Use the Kafka credentials the client would use against Gateway. They depend on Gateway’s security mode, set by GATEWAY_SECURITY_MODE:
  • In KAFKA_MANAGED mode, the backing Kafka cluster checks the credentials. Use a SASL/PLAIN user and password from that cluster.
  • In GATEWAY_MANAGED mode, Gateway checks the credentials. Create a local service account and generate a token for it:
2

Send the record

Produce a JSON value with a string key and an example header. Header values are base64-encoded, and cmVzdA== is rest:
3

Check the response

Gateway returns the topic, partition and offset the record was written to:
Gateway returns the response on a single line. To format it, add -s to the curl command and pipe the output to jq:

Produce several records in one request

Put several record objects one after the other in the body. Gateway returns one result per record, in the same order, and writes the records in that order:
A record that fails doesn’t stop the others. The HTTP status of the response is still 200, so check the errorCode of each result: 200 means the record was written, any other value means it failed, with the reason in message:

Next steps

For every request and response field, the error codes and the differences from Confluent REST Proxy v3, see the produce records API reference.