curl and jq 8 cheatsheet
curl and jq 8: Making requests
9 common curl and jq 8 tasks.
Hide the progress meter
Suppress progress output but still show errors, which suits scripts.
curl -sS https://api.example.com/users
Fetch only the headers
Send a HEAD request and print the response headers.
curl -I https://example.com
POST JSON
Send a JSON body with the correct content type.
curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name":"Ada"}'
POST a JSON file
Send the contents of a file as the request body.
curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d @user.json
Use other HTTP methods
Choose the method with -X, here DELETE.
curl -X DELETE https://api.example.com/users/42
URL-encode a value
Send a value that needs encoding, as a query string for a GET request.
curl -G https://example.com/search --data-urlencode "q=hello world"