RabbitMQ - List Virtual Hosts 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 --user john.doe:itsasecret http://hostname:15671/api/vhosts

 

Or, you can specify a single virtual host.

curl --user john.doe:itsasecret http://hostname:15671/api/vhosts/foo

 

For the / vhost, use %2F.

curl --user john.doe:itsasecret http://hostname:15671/api/vhosts/%2F

 

Something like this should be returned for each virtual host.

{
 "cluster_state": {
   "rabbit@server1": "running",
   "rabbit@server2": "running"
 },
 "description": "example description",
 "metadata": {
   "description": "example description",
   "tags": []
 },
 "name":"foo",
 "tracing":false,
 "cluster_state":{"rabbit@server01":"running"},
 "messages_ready":18,
 "messages_ready_details":{"rate":0.0},
 "messages_unacknowledged":0,
 "messages_unacknowledged_details":{"rate":0.0},
 "messages":18,
 "messages_details":{"rate":0.0}
}

 




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 7ca05 in the box below so that we can be sure you are a human.