Last Updated: February 25, 2016
·
3.209K
· _jeffreyjackson

curl python JSON RESTful API

Using terminal you can get a nice JSON output from a RESTful API using curl.

curl -H 'Accept: application/json' -v http://api.domain.com/someObjectPath/withQuery=parameter | python -m json.tool

The URL should look familiar if you know REST.

Want to store it in a file?

curl -H 'Accept: application/json' -v http://api.domain.com/someObjectPath/withQuery=parameter | python -m json.tool >> file