Posts

Showing posts from March, 2014

cURL to REST API

More curl goodness: curl -i -X PUT -H "Content-Type:application/json" \ http://localhost//restserver/index.php/api/key \ -d '{"level":10}' curl -i -X PUT -H "Content-Type:application/json" \ http://localhost//restserver/index.php/api/example/send \ -d '{"username":"me","password":"1234","level":10}' using a file as input: curl -i -X PUT -H "Content-Type:application/json" \ http://localhost//restserver/index.php/api/key \ -d @filename.json

prettify JSON

To pretty print JSON output you can use the command line... so any cURL request returning JSON can be piped to python: curl http://somesite.com/cont/res/ | python -m json.tool or cat somefile.json / python -m json.tool