RabbitMQ - List Bindings using the REST API

by
Jeremy Canfield |
Updated: February 23 2022
| RabbitMQ articles
This assumes you have created a RabbitMQ user with the administrator tag.
Refer to the RabbitMQ REST API documentation.
The curl command can be used to make an API connection to RabbitMQ. In this example, every binding will be listed.
curl
--request GET
--user john.doe:itsasecret
--url http://server001:15671/api/bindings
Something like this should be returned.
[
{
"arguments" : {},
"destination" : "amq.gen-iRdCIzvottKSQn4hI5VKgw",
"destination_type" : "queue",
"properties_key" : "key002",
"routing_key" : "key002",
"source" : "exchange001",
"vhost" : "/"
},
{
"arguments" : {},
"destination" : "queue001",
"destination_type" : "queue",
"properties_key" : "key001",
"routing_key" : "key001",
"source" : "exchange001",
"vhost" : "/"
]
In this example, only the bindings for queue001 will be listed.
curl
--request GET
--user john.doe:itsasecret
--url http://server001:15671/api/queues/%2f/queue001/bindings
Something like this should be returned.
[
{"source":"","vhost":"/","destination":"queue001","destination_type":"queue","routing_key":"queue001","arguments":{},"properties_key":"queue001"},
{"source":"exchange001","vhost":"/","destination":"queue001","destination_type":"queue","routing_key":"key001","arguments":{},"properties_key":"key001"},
{"source":"exchange001","vhost":"/","destination":"queue001","destination_type":"queue","routing_key":"key002","arguments":{},"properties_key":"key002"},
{"source":"exchange002","vhost":"/","destination":"queue001","destination_type":"queue","routing_key":"key001","arguments":{},"properties_key":"key001"}
]
In this example, the source bindings for exchange001 will be listed.
curl
--request GET
--user john.doe:itsasecret
--url http://server001:15671/api/exchanges/%2f/exchange001/bindings/source
Something like this should be returned.
[
{
"arguments" : {},
"destination" : "amq.gen-iRdCIzvottKSQn4hI5VKgw",
"destination_type" : "queue",
"properties_key" : "key002",
"routing_key" : "key002",
"source" : "exchange001",
"vhost" : "/"
},
{
"arguments" : {},
"destination" : "queue001",
"destination_type" : "queue",
"properties_key" : "key001",
"routing_key" : "key001",
"source" : "exchange001",
"vhost" : "/"
]
Did you find this article helpful?
If so, consider buying me a coffee over at