RabbitMQ - Delete user using the REST API

by
Jeremy Canfield |
Updated: December 29 2022
| RabbitMQ articles
This assumes you have created a RabbitMQ user with the administrator tag.
Refer to the RabbitMQ REST API documentation.
Let's say you want to delete John Doe's user account. You will probably want to list users using the curl command before deleting a user using the curl command. In this example, John Doe's user account exists.
~]# curl --user john.doe:itsasecret http://server001:15671/api/users/john.doe
[
{
"hashing_algorithm": "rabbit_password_hashing_sha256",
"limits": {},
"name": "john.doe",
"password_hash": "cER8LDfLm++IqrqIdMgLpJ0/ADih08ZaZHx3ja+kPXjqNVxL",
"tags": "administrator"
}
]
Here is how you would delete John Doe's user account. If the delete is successfully, no output will be returned. --write-out "%{http_code}" is included to return the http code. The return code should be 204 (success) or 405 (failed).
curl
--request DELETE
--user admin:itsasecret
--url http://server001:15671/api/users/john.doe
--write-out "%{http_code}"
Did you find this article helpful?
If so, consider buying me a coffee over at