curl and jq 8 cheatsheet
curl and jq 8: Debugging and reliability
6 common curl and jq 8 tasks.
See the whole exchange
Print the request and response headers and TLS details.
curl -v https://example.com
Fail on HTTP errors
Return a non-zero exit code on 4xx and 5xx responses, and print the body.
curl --fail-with-body https://api.example.com/users
Retry on failure
Retry up to five times on transient errors.
curl --retry 5 --retry-delay 2 https://example.com
Set a timeout
Give up if the whole operation takes longer than 10 seconds.
curl --max-time 10 https://example.com
Skip TLS certificate checks
Allow connections to servers with invalid certificates. Use it only to debug.
curl -k https://self-signed.example.com
Caution: This disables certificate verification and exposes you to interception. Never use it with real credentials.
Test a host before DNS changes
Send a request to a specific IP address while keeping the host name.
curl --resolve example.com:443:203.0.113.10 https://example.com