Cheatsheet curl
Comandi client HTTP per il debug di API e l'automazione: metodi, payload JSON, header, autenticazione, upload multipart, cookie, tentativi e diagnostica TLS su curl 8.x.
Come funziona
curl transfers URL data from the shell: set method (-X), headers (-H), body (-d/-F), and output (-v/-i/-w) explicitly, because curl prints only the response body by default.
Kit di sopravvivenza
I pochi comandi da imparare per primi.
42 comandi
Requests & Methods
Send GET, HEAD, POST, PUT, PATCH, and DELETE requests with clean headers.
- Essenziale
Fetch a URL and print the response body to stdout
curl <url>Componi il comando
curl <url>I valori vengono inseriti esattamente come li digiti. Racchiudili tra virgolette se contengono spazi o caratteri speciali.
Quando usarlo
Baseline check for reachability, response payload, and pipe integration with jq.
Esempio
curl https://api.example.com/healthRisultato
{"status":"ok","version":"2.4.0"}
Payloads, Forms & Files
Send JSON, URL-encoded forms, multipart uploads, and binary bodies.
Auth, Cookies & TLS
Authenticate requests, manage cookies, resolve hosts, and verify certificates.
Headers, Timing & Debugging
Inspect TLS handshakes, response headers, status codes, and per-phase latency.
Downloads, Retries & Limits
Write files safely, resume interrupted downloads, cap wait time, and retry.