Date created: Sunday, April 30, 2023 4:22:51 PM. Last modified: Monday, September 22, 2025 2:27:31 PM
'curl' - Notes
Basic token auth:
curl -H "Authorization: Token XXXXXXX" -H "Accept: application/json; indent=4" -k https://myapp.net/api/get/object/1
HTTP Status code:
root@84547d3c697e:/# curl -I https://null.53bits.co.uk/
HTTP/2 200
Replay JSON data:
curl -4s \
-H "Accept: application/json" \
https://rest.db.ripe.net/ripe/person/JBIL-RIPE | jq > test_data.json
sed -i 's/JBIL/JBIL2/g' test_data.json
curl -4sX POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data @test_data.json \
https://rest.db.ripe.net/ripe/person/?password=mainterin-password-here\&dry-run
Retry:
cURL can retry N number of times, without a timeout, using purely built in CLI switches, there is no need to write a loop in BASH for this:
curl --silent --fail-with-body --connect-timeout 5 --retry-all-errors --retry-delay 1 --retry-max-time 300 --retry 300 10.0.0.1:8080/health
Previous page: CIFS/SMB Notes
Next page: 'dd' - Notes