
curl Command Examples for REST APIs (2025 Reference)
curl is the universal tool for interacting with HTTP APIs. It runs on every platform, requires no setup, and outputs raw responses you can inspect, pipe, and script. Once you know the core flags, you can test any REST API without opening Postman. This is a practical reference — organized by task, with real-world examples you can copy and adapt. Essential Flags to Know First -X METHOD # HTTP method (GET is default) -H "Header" # Add a request header -d "data" # Request body (implies POST) -s # Silent mode (no progress meter) -i # Include response headers in output -I # Fetch only headers (HEAD request) -v # Verbose: show full request + response -o file.json # Save response to a file -w "format" # Write-out (print specific values after response) -L # Follow redirects -k # Skip SSL verification (dev only, never production) --compressed # Request and decompress gzip responses GET Requests Basic GET curl https://api.github.com/users/octocat Pretty-print JSON response curl -s https://api.git
Continue reading on Dev.to Webdev
Opens in a new tab




