Simon,<div><br></div><div>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. </div><div><br></div><div>Thanks,</div><div>
Allan<br><br><div class="gmail_quote">On Tue, Apr 10, 2012 at 12:22 PM, Simon MacMullen <span dir="ltr"><<a href="mailto:simon@rabbitmq.com">simon@rabbitmq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10/04/2012 5:07PM, Allan Feid wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I've been trying to use the API to create user permissions, but this<br>
seems to fail. According to the documentation<br>
/api/permissions/vhost/<u></u>username should return the permissions for that<br>
user, but this fails with a 404. Using /api/permissions/vhost does show<br>
all the usernames properly, so I figured I'd try to run PUT against the<br>
username path, and that too fails with a 404. What is the proper request<br>
to add/change permissions for a user? I attempted to use<br>
/api/users/username/<u></u>permissions, but that returns a method not allowed<br>
for PUT requests, as I expected.<br>
</blockquote>
<br>
Hi. Are you sure you are getting the username right? This works for me:<br>
<br>
$ curl -i -u guest:guest -H "content-type:application/<u></u>json" -XPUT \<br>
-d'{"configure":"foo","write":<u></u>"bar","read":"baz"}' \<br>
<a href="http://localhost:55672/api/permissions/%2f/guest" target="_blank">http://localhost:55672/api/<u></u>permissions/%2f/guest</a><br>
HTTP/1.1 204 No Content<br>
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)<br>
Date: Tue, 10 Apr 2012 16:15:58 GMT<br>
Content-Type: application/json<br>
Content-Length: 0<br>
<br>
$ curl -i -u guest:guest -H "content-type:application/<u></u>json" \<br>
<a href="http://localhost:55672/api/permissions/%2f/guest" target="_blank">http://localhost:55672/api/<u></u>permissions/%2f/guest</a><br>
HTTP/1.1 200 OK<br>
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)<br>
Date: Tue, 10 Apr 2012 16:16:55 GMT<br>
Content-Type: application/json<br>
Content-Length: 73<br>
Cache-Control: no-cache<br>
<br>
{"user":"guest","vhost":"/","<u></u>configure":"foo","write":"bar"<u></u>,"read":"baz"}<br>
<br>
Cheers, Simon<br>
</blockquote></div><br></div>