curl
Client for URLs. A tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, etc.). Essential for testing APIs.
Synopsis
curl [options] [url]
Core Options
-X METHODSpecify request method (GET, POST, PUT, DELETE, etc.).
-H 'Header: Value'Add a custom header to the request.
-d 'data'Send data (e.g., JSON) in a POST request.
-o fileWrite output to <file> instead of stdout.
-IFetch the HTTP-header only.
-LFollow redirects.
Usage Examples
GET Request
Fetch the content of a page.
curl https://api.github.comDownload File
Download a file and save it with a specific name.
curl -o archive.zip https://example.com/file.zipPOST JSON Data
Send a POST request with JSON body and Content-Type header.
curl -X POST -H 'Content-Type: application/json' -d '{"name":"John"}' https://api.example.com/usersCheck Headers
View response headers only (useful for checking status codes or cache headers).
curl -I https://google.comFollow Redirects
Follow 3xx redirects to the final destination.
curl -L http://google.comBuilt for builders.