Hello, I am following the restful APIs video on vimeo (http://vimeo.com/ 21133657) Now I am trying to test the manage_dog POST with curl:
curl -i -H "Accept: application/json" -X POST -d "info=aNewInfo, owner=55, name=aNewName" http://localhost:8000/restful/api/manage_dog/ However, this gives a bad request: HTTP/1.1 400 BAD REQUEST Set-Cookie: session_id_restful=127.0.0.1-31e461ce-6809-403d- b069-6789d7069184; Path=/ Content-Length: 540 Content-Type: text/html; charset=UTF-8 Date: Fri, 19 Aug 2011 08:53:27 GMT Server: Rocket 1.2.2 Python/2.7.1 Connection: keep-alive invalid arguments<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //-- > This works, but gives me the full html response (I'll only post the header): curl -i -d "info=aInfo&name=aName&owner=74" http://localhost:8000/restful/api/manage_dog HTTP/1.1 200 OK X-Powered-By: web2py Set-Cookie: session_id_restful=127.0.0.1-bc6e42b7- c156-4e58-97cc-991f11cbba38; Path=/ Expires: Fri, 19 Aug 2011 08:59:04 GMT Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Content-Type: text/html; charset=utf-8 Date: Fri, 19 Aug 2011 08:59:04 GMT Server: Rocket 1.2.2 Python/2.7.1 Content-Length: 33287 Connection: keep-alive So my question is: How to post and receive only JSON values? Thanks, Christian P.S: the other things, like e.g. DELETE works perfect curl -i -X DELETE -H "Accept: application/json" http://localhost:8000/restful/api/manage_dog/4.json and gives: HTTP/1.1 200 OK X-Powered-By: web2py Set-Cookie: session_id_restful=127.0.0.1-3407919a-f841-4f34-8f5e- b74b68449231; Path=/ Expires: Fri, 19 Aug 2011 09:07:31 GMT Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Content-Type: text/html; charset=utf-8 Date: Fri, 19 Aug 2011 09:07:31 GMT Server: Rocket 1.2.2 Python/2.7.1 Content-Length: 3 Connection: keep-alive {}