Skip to main content

Command Palette

Search for a command to run...

Getting Started with cURL

Updated
•6 min read•View as Markdown
Getting Started with cURL
S

Hi, I’m Swastisunder 👋 I’m a full-stack web developer focused on building clean, modern, and practical web applications. I work mainly with the MERN stack (MongoDB, Express, React, Node.js) and enjoy turning ideas into real, usable products. Right now, I’m also learning Python and AI/ML, one concept and one project at a time. Always learning. Always building.

Every time you open website inside browser…

your browser sends request to server.

Then server sends response back.

Very simple idea honestly.

Something like this:

Browser → Server → Response

But sometimes developers dont want full browser.

Sometimes they just want directly talk to server.

From terminal.

That is where:

cURL

comes in.

And honestly…

cURL is one of the most useful beginner tools for backend and API learning.


What Is A Server

Before understanding cURL, first we need understand server.

Server is basically computer which waits for requests.

Like:

  • websites

  • APIs

  • apps

  • databases

When you open:

google.com

your browser sends request to Google's server.

Then server replies with:

  • HTML

  • images

  • data

  • videos

  • JSON

Basically server gives you whatever you requested.

Simple thought:

Server is like restaurant kitchen.

You order something.

Kitchen prepares response.

Then sends it back.


What Is cURL

cURL is command line tool used to talk with servers.

Instead of using browser buttons, you manually send requests using terminal.

Simple example:

curl https://google.com

This command tells server:

“Hey server, send me webpage data.”

And server replies directly inside terminal.

Simple thought:

cURL is like talking to server manually without browser UI.


Why Programmers Need cURL

cURL is heavily used by:

  • backend developers

  • API developers

  • DevOps engineers

  • testers

Because sometimes developers need:

  • test APIs

  • debug backend

  • check responses

  • send requests manually

Without opening browser again and again.

cURL is:

  • fast

  • lightweight

  • simple

  • available almost everywhere

And honestly…

once you start backend development, you will use cURL a lot.


Your First cURL Request

Lets make first request.

Command:

curl https://example.com

What happens internally:

Your Terminal
      ↓
cURL
      ↓
Server
      ↓
Response

Server sends webpage data back.

Usually HTML.

Something like:

<html>
  <body>
    Example Website
  </body>
</html>

Which browser normally renders visually.

But terminal just prints raw response.


Understanding Request And Response

Internet communication mostly works using:

Request → Response

Very simple idea.


Request

Request means:

“Hey server, give me something.”

Example:

curl https://api.github.com

Response

Response means:

“Okay. Here is your data.”

Server sends back:

  • status

  • headers

  • data

Sometimes JSON.

Sometimes HTML.

Sometimes error.


Understanding Status Codes

Every server response contains status code.

Common examples:

Status Code Meaning
200 Success
404 Not Found
500 Server Error

Simple thought:

200 = everything good

404 = page missing

500 = server broke internally

Using cURL With APIs

One of biggest use cases of cURL is APIs.

API means:

Application Programming Interface

Which is basically way for apps to communicate.

Example request:

curl https://jsonplaceholder.typicode.com/users

Response:

[
  {
    "id": 1,
    "name": "Leanne Graham"
  }
]

Now server is returning JSON data instead of webpage.

This is how frontend and backend communicates in real applications.


GET Requests

By default, cURL sends:

GET Request

GET means:

“I only want to fetch data.”

Example:

curl https://api.github.com

Very simple.

Fetch data only.


POST Requests

POST means:

“I want to send data to server.”

Example:

curl -X POST https://example.com

POST is commonly used for:

  • login

  • signup

  • forms

  • creating data

Simple thought:

GET = give me data

POST = take my data

Browser Request vs cURL Request

Normally browser does many extra things:

  • renders webpage

  • loads CSS

  • loads images

  • executes JavaScript

But cURL only sends request and shows response.

Simple comparison:

Browser cURL
Visual UI Terminal
Loads full webpage Shows raw response
User friendly Developer friendly
Heavy Lightweight

Common Beginner Mistakes

Forgetting URL

Wrong:

curl

Server address missing.


Confusing GET And POST

Beginners sometimes sends POST when they only need GET.

Remember:

GET = fetch

POST = send

Thinking cURL Is Browser

cURL does not render webpages visually.

It only shows raw server response.


Panicking After Seeing HTML

When beginners runs:

curl https://google.com

terminal prints huge HTML mess.

That is normal honestly.

Browser normally converts that HTML into proper webpage.


Real World Backend Usage

Backend developers uses cURL for:

  • testing APIs

  • debugging backend

  • checking authentication

  • verifying server responses

  • learning HTTP

Even many production systems internally works using same request-response idea.

So learning cURL also helps understand:

  • APIs

  • backend systems

  • HTTP

  • networking


Full cURL Flow Diagram

Terminal
   ↓
cURL
   ↓
Server
   ↓
Response
   ↓
Terminal Output

Very simple flow.

But extremely important for backend development.


Summary

Concept Meaning
Server Computer serving requests
cURL Tool to talk with servers
Request Asking server for something
Response Server reply
GET Fetch data
POST Send data
API Communication system between apps
Status Code Response result

Useful Beginner Commands

# Simple webpage request
curl https://example.com

# API request
curl https://api.github.com

# Fetch JSON data
curl https://jsonplaceholder.typicode.com/users

# Simple POST request
curl -X POST https://example.com

Final Thoughts

At first…

cURL feels very boring.

Just terminal commands.

Nothing fancy.

But internally…

cURL teaches one of the most important ideas in backend development:

Request → Server → Response

Which is basically foundation of modern web.

Websites.

APIs.

Mobile apps.

Cloud systems.

Everything depends on this communication model.

And honestly…

once you start understanding cURL, backend development suddenly starts making much more sense.

More from this blog

W

WebDev 2026

16 posts

A developer blog where I share web development, networking, JavaScript, Git, Node.js and computer science concepts in simple and beginner friendly way. Some blogs are technical deep dives, some are story based explanations, and some are part of my learning journey as a developer. This blog is basically my public notebook where I learn, build, experiment and explain things in the simplest way possible.