curl

A command-line tool for sending web requests and printing the response.

In more detail

Flags such as -i (show response headers), -H (add a header) and -X (choose the method) let you build and inspect any request from a terminal. In scripts, -s hides the progress meter and -f makes curl fail on HTTP error codes instead of saving the error page.

Examples

In the APIs course: The course uses curl to show whole exchanges: -s hides the progress bar, -i prints the status line and headers, -I sends a HEAD request, -H adds a header and --json sends a JSON body.
curl -si localhost:8765/tasks/1
curl -si -H 'If-None-Match: "1"' localhost:8765/tasks/1
curl -fsS https://example.com/status.json -o status.json
curl -sS -H "authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com"
kubectl run smoke --rm -it --image=curlimages/curl -- curl web
curl -s http://localhost:18080/health
curl -i http://localhost:3000/api/health
curl -N http://localhost:3000/api/chat
curl -s localhost:8000/metrics | grep http_requests_total
auditd records curl fetching a file into a hidden name in /tmp.
CVE-2023-38545 in curl appears in two scanners' rows for the same image

Related terms

Taught in

References

Certification courses