The following API call to RabbitMQ:
http -a USER:PASS localhost:15001/api/queues/
Returns a list of queues:
[
{
...
"messages_unacknowledged_ram": 0,
"name": "foo_queue",
"node": "rabbit@queue-monster-01",
"policy": "",
"state": "running",
"vhost": "/"
},
...
]
Note that the vhost
parameter is /
.
How do I use a /
vhost
for the /api/queues/vhost/name
call, which returns the details for a specific queue?
I have tried:
localhost:15001/api/queues/\//foo_queue
localhost:15001/api/queues///foo_queue
But both failed with 404 Object Not Found
:
When configuring RabbitMQ, at least one vhost is needed, which in default is just a slash “/”. Vhosts are created through the management portal, through the HTTP API or via rabbitmqctl. View vhosts by entering the admin tab and select the Virtual Hosts. Select the Add New Virtual Host options to create a new vhost.
The error “no access to the vhost” on the RabbitMQ, may happen in case the user which runs the RabbitMQ doesn't have any permissions configured for the vhost used (“/” by default), or in case RabbitMQ wasn't shut down correctly (for example in case we ran out of disk space).
The rabbitmq-management plugin provides an HTTP-based API for the management and monitoring of your RabbitMQ server. It enables by default on all CloudAMQP instances and assigned port 443. The full HTTP API reference can be found in the official RabbitMQ Management HTTP API documentation.
Different users can be granted access only to specific virtual hosts. Their permissions in each virtual hosts also can be limited. RabbitMQ supports two major authentication mechanisms as well as several authentication and authorisation backends. Password-based authentication has a companion guide.
URL Encoding did the trick. The URL should be:
localhost:15001/api/queues/%2F/foo_queue
⬆⬆⬆
For the record, I think that REST resources should not be named /
, especially not by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With