$devvkit learn --librarie curl-guide
cURL Guide
[http][api][cli][networking]
Universal
Install
# macOS (pre-installed) / Linux sudo apt install curl # Windows winget install curl.curl
cURL is the Swiss Army knife of HTTP clients. Every developer reaches for curl at some point.
What makes curl indispensable is its predictability. Once you learn the flag-based syntax, it works the same on your laptop, a CI runner, a Docker container, or a production server.
Basic Requests
GET request— Fetch a URL and print the response body.
curl https://api.example.com/users
GET with verbose— See request/response headers and timing.
curl -v https://api.example.com/users
Follow redirects— Automatically follow Location headers.
curl -L https://example.com
Custom HTTP method— Use -X to specify method.
curl -X POST https://api.example.com/users
Headers & Auth
Set request header— Add a custom HTTP header.
curl -H "Authorization: Bearer token123" https://api.example.com/users
Basic auth— Send HTTP Basic Authentication.
curl -u username:password https://api.example.com/login
Data Transfer
POST JSON body— Send a JSON payload.
curl -X POST -H "Content-Type: application/json" -d '{"name":"Alice"}' https://api.example.com/usersUpload file— Upload a file as multipart/form-data.
curl -F "file=@photo.jpg" https://api.example.com/upload
Download file— Save response body to a file.
curl -o output.json https://api.example.com/users
Debugging
Show headers only— Fetch only the HTTP headers.
curl -I https://example.com
Scripting
Silent mode— Suppress progress output.
curl -s https://api.example.com/users
Retry on failure— Automatically retry on errors.
curl --retry 3 --retry-delay 5 https://api.example.com/users