[rabbitmq-discuss] Http API: new user

Matthias Radestock matthias at rabbitmq.com
Fri Aug 23 17:33:27 BST 2013


On 22/08/13 17:51, SAG - Jonathan Andrés wrote:
> Yes, you are right, sorry, I did it in a hurry.
>
> But If i try with this:
>
> curl -i -v -u guest:guest -H "content-type:application/json" -XPUT -d'{"password":"secret","tags":"administrator"}' http://localhost:15672/api/users/newUser
>
>
> Now i get this:
>
> Error: bad_request, Reason: not_json.

The above works fine for me against 3.1.5 on Erlang R16B:

$ curl -i -v -u guest:guest -H "content-type:application/json" -XPUT 
-d'{"password":"secret","tags":"administrator"}' 
http://localhost:15672/api/users/newUser
* About to connect() to localhost port 15672 (#0)
*   Trying 127.0.0.1... connected
* Server auth using Basic with user 'guest'
 > PUT /api/users/newUser HTTP/1.1
 > Authorization: Basic Z3Vlc3Q6Z3Vlc3Q=
 > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 
OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
 > Host: localhost:15672
 > Accept: */*
 > content-type:application/json
 > Content-Length: 44
 >
* upload completely sent off: 44out of 44 bytes
< HTTP/1.1 204 No Content
HTTP/1.1 204 No Content
< Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
< Date: Fri, 23 Aug 2013 16:28:43 GMT
Date: Fri, 23 Aug 2013 16:28:43 GMT
< Content-Type: application/json
Content-Type: application/json
< Content-Length: 0
Content-Length: 0

<
* Connection #0 to host localhost left intact
* Closing connection #0


Perhaps you are running a rabbit/erlang that is too old.


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list