Confluent REST APIs

The Confluent REST Proxy provides a RESTful interface to a Apache Kafka cluster,this is making easy to produce and consume messages, view the cluster state , and perform administrative actions without using the native Kafka clients or protocol.

Some use cases are:
  • Reporting data to Kafka from any frontend app built in any language not supported by official Confluent clients.
  • Ingesting messages into a stream processing framework that doesn't yet support Kafka.
  • Scripting administrative actions.

There is a plugin available for Confluent REST Proxy that is helping authenticate incoming requests and propagates the authenticated principal to requests to Kafka. This enables Confluent REST Proxy clients to utilize the multi-tenant security features of the Kafka broker.

The Admin REST APIs allow you to create and manage topics, manage MDS, and produce and consume to topics. The Admin REST APIs are available in these forms.

Here are the some of rest api commands
#Create the topic#

./kafka-topics --create --topic test-rest-topic --partitions 3 --replication-factor 1 --zookeeper localhost:2181

#Send the message to test-rest-topic using rest api#
curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" --data '{"records":[{"value":{"id":1,"name":"Arvind","designation":"Developer"}}]}' "http://localhost:8082/topics/test-rest-topic"

curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" --data '{"records":[{"value":{"id":2,"name":"Suresh","designation":"Developer"}}]}' "http://localhost:8082/topics/test-rest-topic"

curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" --data '{"records":[{"value":{"id":1,"name":"Arvind","designation":"Developer"}}]}' "http://localhost:8082/topics/test-rest-topic"

curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" --data '{"records":[{"value":{"id":2,"name":"Suresh","designation":"Developer"}}]}' "http://localhost:8082/topics/test-rest-topic"

#Go and check the data using consumer command for test-rest-topic#
./kafka-console-consumer --topic test-rest-topic --bootstrap-server localhost:9092 --from-beginning