[rabbitmq-discuss] http api for creating user permissions
Simon MacMullen
simon at rabbitmq.com
Tue Apr 10 17:22:11 BST 2012
On 10/04/2012 5:07PM, Allan Feid wrote:
> I've been trying to use the API to create user permissions, but this
> seems to fail. According to the documentation
> /api/permissions/vhost/username should return the permissions for that
> user, but this fails with a 404. Using /api/permissions/vhost does show
> all the usernames properly, so I figured I'd try to run PUT against the
> username path, and that too fails with a 404. What is the proper request
> to add/change permissions for a user? I attempted to use
> /api/users/username/permissions, but that returns a method not allowed
> for PUT requests, as I expected.
Hi. Are you sure you are getting the username right? This works for me:
$ curl -i -u guest:guest -H "content-type:application/json" -XPUT \
-d'{"configure":"foo","write":"bar","read":"baz"}' \
http://localhost:55672/api/permissions/%2f/guest
HTTP/1.1 204 No Content
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Tue, 10 Apr 2012 16:15:58 GMT
Content-Type: application/json
Content-Length: 0
$ curl -i -u guest:guest -H "content-type:application/json" \
http://localhost:55672/api/permissions/%2f/guest
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Tue, 10 Apr 2012 16:16:55 GMT
Content-Type: application/json
Content-Length: 73
Cache-Control: no-cache
{"user":"guest","vhost":"/","configure":"foo","write":"bar","read":"baz"}
Cheers, Simon
More information about the rabbitmq-discuss
mailing list