curl
Send an HTTP request from the terminal
What it does
curl sends a request to an address and prints the response. On a server this is how you check that a site or API answers: curl http://localhost:3000/health. -I asks for the headers only, so you see the status code, redirects and caching.
-L follows redirects, -o <file> saves the response to a file, and -X POST with -d sends data. -v shows the whole exchange with the server, TLS included, which helps when something does not work.
Syntax
curl <url>
curl -I <url>
curl -L -o <file> <url>Examples
Ask https://example.com for the response headers only
curl -I https://example.comsame as:
curl --head https://example.comcurl— an HTTP request from the terminal-I— headers only: status, redirects, cachinghttps://example.com— the address