Search code examples
apache-kafkakafka-rest

How to change Kafka Rest Proxy CURL command in order to use it in a browser


I'm trying out Rest Proxy in Kafka.

When I type the following url in my browser http://192.168.0.30:8082/topics,

I get the expected results :

["__confluent.support.metrics","_confluent-command","_confluent-controlcenter-5-
2-2-1-MetricsAggregateStore-changelog","_confluent-controlcenter-5-2-2-1-actual-
group-consumption-rekey","_confluent-controlcenter-5-2-2-1-expected-group-
consumption-rekey","_confluent-controlcenter-5-2-2-1-metrics-trigger-measurement-
rekey","_confluent-ksql-default__command_topic","_confluent-metrics","_confluent-
monitoring","_schemas","connect-configs","connect-offsets","connect-
statuses","default_ksql_processing_log","test","test1"]


My question : I try not to use CURL. I have the following CURL command examples . If I want to use only my browser like above, how can I change it?

I tried this, but... (How can I consume my topic test?) enter image description here

**Just an example from a document : **

# Create a consumer for binary data, starting at the beginning of the topic's
# log. Then consume some data from a topic.
$ curl -X POST -H "Content-Type: application/vnd.kafka.v1+json" \
      --data '{"id": "my_instance", "format": "binary", "auto.offset.reset": "smallest"}' \
      http://localhost:8082/consumers/my_binary_consumer
  {"instance_id":"my_instance","base_uri":"http://localhost:8082/consumers/my_binar
y_consumer/instances/my_instance"}

$ curl -X GET -H "Accept: application/vnd.kafka.binary.v1+json" \
      http://localhost:8082/consumers/my_binary_consumer/instances/my_instance/topics/test
  [{"key":null,"value":"S2Fma2E=","partition":0,"offset":0}]

Solution

  • Browsers can only issue GET requests.

    You could use tools like Postman or Insomnia to issue other HTTP requests.