[rabbitmq-discuss] http api for creating user permissions
Allan Feid
allanfeid at gmail.com
Tue Apr 10 18:01:43 BST 2012
Simon,
Looks like %2f was needed here. It was weird because my browser/ruby client
handled "/api/permissions///" just fine, but not one more level deep.
Thanks,
Allan
On Tue, Apr 10, 2012 at 12:22 PM, Simon MacMullen <simon at rabbitmq.com>wrote:
> 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://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://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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120410/97d02b20/attachment.htm>
More information about the rabbitmq-discuss
mailing list