Getting Started with cURL
If you want to become a backend developer, API developer, or even a confident frontend developer, cURL is one of those tools you will keep meeting again and again.
At first, it looks scary.
Black terminal. White text. Too much output.
But once you understand what problem it solves, cURL becomes simple and predictable.
Let’s start from the beginning.
What is a server and why do we need to talk to it?
A server is just a computer.
But not a normal computer like your laptop.
A server’s job is simple:
- Store data
- Process requests
- Send responses
›Real-life example
Imagine you are sitting in a restaurant.
- You are the client
- The waiter carries your message
- The kitchen is the server
- The food is the response
You say:
“I want a pizza”
That is a request.
The kitchen prepares the pizza and sends it back.
That is a response.
Websites work the same way.
When you open a website:
- Your browser sends a request
- A server processes it
- The server sends data back (HTML, JSON, images)
What is cURL?
cURL stands for Client URL.
In very simple words:
> cURL is a tool that lets you talk to servers directly from your terminal.
>
No browser.
No buttons.
No UI.
Just you, your terminal, and the server.
You send a message.
The server replies.
That’s it.
Why programmers need cURL
Programmers need cURL because:
- Browsers hide what is really happening
- APIs usually do not have a UI
- Backend developers need to test servers directly
With cURL, you can:
- Test APIs
- Debug server responses
- Check if backend is running
- See raw data from the server
If you work with:
- Node.js
- Express
- Next.js APIs
- Any backend
You will use cURL.
Making your first request using cURL
›Step 1: Check if cURL is installed
Open your terminal or command prompt and run:
curl --versionIf you see something like:
curl 8.16.0cURL is installed.
If you see:
'curl' is not recognized as an internal or external commandIt means cURL is not installed.
You can install it using this video guide:
https://www.youtube.com/watch?v=cl186ePedMg
›Step 2: Make your first request
Run this command:
curl <https://www.punyanshsingla.com>Press Enter.
You will see a lot of text.
Do not panic.
That text is just:
- HTML
- CSS links
- Script references
In simple words:
> You asked a server for a webpage, and the server sent the webpage code.
>
Congratulations.
You just made your first cURL request.
Understanding request and response
The web works on a simple conversation model.
›Request
A request is what you send to the server.
Examples:
- Give me a webpage
- Save this form
- Create a user
- Fetch products
›Response
A response is what the server sends back.
Examples:
- HTML page
- JSON data
- Success message
- Error message
›Simple analogy
In a footwear shop:
- You ask for shoe size 7 → request
- Shopkeeper gives size 7 → response
Same logic. Different place.
Understanding the response
A server response mainly has two important parts.
›1. Status Code
A status code is a 3-digit number sent by the server to tell what happened.
›200 – Success
Everything worked fine.
Example:
You ordered paneer tikka and got paneer tikka.
›204 – Success but no content
The request worked, but nothing is returned.
Example:
You cancelled your order.
Cancellation successful, no food delivered.
›400 – Bad Request
The server did not understand your request.
Example:
You say to the waiter:
“Bring water fries”
›404 – Not Found
The thing you asked for does not exist.
Example:
You ask for sandals.
Shopkeeper says:
“We don’t have that.”
›429 – Too Many Requests
You are sending requests too fast.
Example:
Too many customers, one chef.
Waiter asks you to wait.
›500 – Internal Server Error
The server failed internally.
Example:
Chef slipped in the kitchen.
Not your fault.
›Learn more about status codes
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status
- https://blog.postman.com/what-are-http-status-codes/
- https://www.w3schools.com/tags/ref_httpmessages.asp
- https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
›2. Data
Data is the actual content returned by the server.
It can be:
- HTML (web pages)
- JSON (APIs)
- Text
- Error messages
When you ran:
curl <https://www.punyanshsingla.com>The data returned was the HTML of the website.
Using cURL to talk to APIs
APIs usually return JSON, not HTML.
Example:
curl <https://api.github.com>You will see structured JSON data like:
{
"current_user_url": "...",
"authorizations_url": "..."
}This is how backend developers test APIs without building a frontend.
GET and POST (only the basics)
›GET request
Used to get data from the server.
curl <https://example.com/products>Meaning:
“Give me products”
›POST request
Used to send data to the server.
Common use cases:
- Login
- Signup
- Creating records
Conceptually:
“Here is some data, please save it”
We avoid complex flags for now.
Browser request vs cURL request
›Browser
- Has UI
- Automatically sends headers
- Hides network details
›cURL
- No UI
- Fully transparent
- Manual control
Same destination.
Different tools.
Where cURL fits in backend development
cURL is useful:
- Before frontend exists
- While debugging APIs
- While testing deployments
- When frontend breaks but backend works
Backend is the engine.
cURL is how you test it directly.
Common mistakes beginners make with cURL
- Getting scared by large output
- Thinking cURL is outdated
- Using too many flags too early
- Treating errors as failure
- Testing APIs only through browser
Mental diagrams
›Request flow
cURL → Server → Response›Browser vs cURL
Browser → Server → UI + Data
cURL → Server → Raw Data›Basic HTTP structure
Request:
- Method (GET / POST)
- URL
Response:
- Status Code
- DataFinal thoughts
cURL is not fancy.
But it teaches you something important:
> How the web actually communicates.
>
Once you understand cURL:
- APIs feel clear
- Backend feels logical
- Debugging becomes easier
Start slow.
One command at a time.