curl -i localhost/api/foo
curl -v localhost/api/foo
Unix:
curl -X POST -d '"foo"' localhost/api/foo
Windows:
curl -X POST -d "\"foo\"" localhost/api/foo
Unix:
curl -X POST -H "Content-Type: application/json" -d '{"foo": "bar"}' localhost/api/foo
Windows:
curl -X POST -H "Content-Type: application/json" -d "{\"foo\": \"bar\"}" localhost/api/foo
curl --ntlm -u : example.com
Syntax highlight JSON using jq
curl -s localhost/api/foo | jq .
Count number of returned objects using jq
curl -s localhost/api/foo | jq length
Return partial JSON properties using jq
curl -s localhost/api/foo | jq '.[] | { name: .author.name }'
or shorthand for top-level properties
curl -s localhost/api/foo | jq '.[] | { name }'
curl -s localhost/api/foo | jq -c '.[] | { name }'
curl -s localhost/api/foo | jq '.[0] | keys'
curl -s http://www.whatsmyip.org/http-compression-test/ -w '%{size_download}' -o /dev/null