RabbitMQ - List Exchanges using the REST API

This assumes you have created a RabbitMQ user with the administrator tag.

Refer to the RabbitMQ REST API documentation.

The curl command with the --user option can be used to make an API connection to RabbitMQ. In this example, John Doe will make a connection to the RabbitMQ server listening on port 15671. Or, the rabbitmqctl list_queues or rabbitmqadmin list queues commands can be used.

curl
--request GET
--user john.doe:itsasecret
--url http://hostname:15671/api/exchanges

 

Or, you can list all of the exchange in a specific virtual host.

curl
--request GET
--user john.doe:itsasecret
--url http://hostname:15671/api/exchanges/vhost001

 

Or, you can specify a specific exchange in a specific virtual host.

curl
--request GET
--user john.doe:itsasecret
--url http://hostname:15671/api/exchanges/vhost001/exchange001

 

For the / vhost, use %2F.

curl
--request GET
--user john.doe:itsasecret
--url http://hostname:15671/api/exchanges/%2F/exchange001

 

If the exchange does not exist, something like this should be returned.

{"error":"Object Not Found","reason":"Not Found"}

 

Something like this should be returned for each exchange.

{
 'outgoing' => [],
 'name' => 'exchange001',
 'durable' => 1,
 'message_stats' => {
   'publish_in' => 3,
   'publish_out_details' => {
     'rate' => '0'
   },
   'publish_in_details' => {
     'rate' => '0'
   },
   'publish_out' => 2
 },
 'auto_delete' => '',
 'vhost' => '/',
 'incoming' => [],
 'arguments' => {},
 'type' => 'direct',
 'internal' => ${\$VAR1->{'auto_delete'}}
};

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter f3e3f in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |