Skip to content

Instantly share code, notes, and snippets.

@gwenshap
Created March 24, 2017 20:20
Show Gist options
  • Save gwenshap/d609cfaa3fbd565982331c3483c7e6da to your computer and use it in GitHub Desktop.
Save gwenshap/d609cfaa3fbd565982331c3483c7e6da to your computer and use it in GitHub Desktop.
REST Proxy V2 examples
Create JSON consumer:
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" --data '{"name": "my_consumer_instance", "format": "JSON", "auto.offset.reset": "earliest"}' http://localhost:8082/consumers/my_json_consumer
{"instance_id":"my_consumer_instance", "base_uri":"http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance"}
Subscribe consumer to a topic:
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" --data '{"topics":["jsontest"]}' http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance/subscription
Consume:
curl -X GET -H "Accept: application/vnd.kafka.json.v2+json" http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance/records
curl -X GET -H "Accept: application/vnd.kafka.json.v2+json" http://localhost:8082/consumers/my_json_consumer/instances/my_consumer_instance/topics/jsontest
Delete:
curl -X DELETE http://localhost:8082/consumers/my_json_consumer/instances/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment