curl
The Problem
How do you test backend APIs directly without building a front end? How do you inspect what’s actually sent over the wire? curl provides a CLI interface to speak HTTP directly — essential for backend development and debugging.
Core Idea
curl is a command-line tool that sends HTTP requests and prints the response. It bypasses browsers — you can directly test endpoints, inspect headers, send POST data. It’s the backend developer’s direct connection to the server.
How It Works
- Parse URL: curl extracts protocol, domain, port, path from the URL
- DNS Lookup: Resolves domain to IP address
- Socket Connection: Opens TCP socket to IP:port
- TLS Handshake: For HTTPS, establishes encrypted connection
- Send Request: Writes raw HTTP request text to socket
- Receive Response: Reads response from server and prints to terminal
Get Animesh Mishra’s stories in your inbox
Join Medium for free to get updates from this writer.
Example: curl https://example.com sends GET / HTTP/1.1 and prints the HTML response.
Key Properties
- CLI tool available on all major operating systems
- Supports multiple protocols: HTTP, HTTPS, FTP, etc.
- Options: -X (method), -H (headers), -d (body), -v (verbose)
- Great for API testing:
curl -X POST -H "Content-Type: application/json" -d '{"name":"ani"}' https://api.example.com - -v flag shows full request/response headers and connection details
- Does not execute JavaScript like browsers do








