# Getting Started with cURL

Hey Everyone,

In this blog, we will be learning about cURL. A simple tool, yet powerful, used to communicate with the server from your terminal.

Before starting with cURL, let’s first understand what a server is.

It is like a computer:

* That listens to your request
    
* Do some logic
    
* Send back a response
    

When you open a website in a browser

* Your browser send request to the server.
    
* Server will return with HTML, CSS and JS files.
    

### What is cURL?

It is a command-line tool that lets you send requests to a server and view the responses in the terminal.

It is a way to communicate with the server without the browser.

Instead of typing the URL in Chrome, just run a command in the terminal. That’s it.

### Why programmers need cURL

The browser hides many details

Programmers often need to:

* Test API
    
* Get the status of the server
    
* debug backend
    

cURL helps because:

* It is fast
    
* it shows what the response of the server is
    
* It is available on Mac, Windows, linux.
    

### Making your first request using cURL

Let’s start with the basic command

```bash
curl www.example.com
```

After entering this command in the terminal

* cURL sends a request to www.example.com.
    
* The server responds with the data, and cURL prints it in the terminal.
    

## Understanding request and response

The communication between the server and client has two parts

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769709013060/70e4ef22-de2d-48d9-8a88-00280fa50ae8.png align="center")

### Request

A request contains:

* Where you want to go (URL)
    
* What do you want to perform (GET, POST, etc)
    

### Response

A response contains:

* Status Code
    
* Data
    

Some of the status codes. No need to learn, you will learn it on the go while working with them

Status Code

* Status `200` → Success
    
* Status `404` → Not found
    
* Status `500` → Server error
    

For now, remember this:

> **Request asks. Response answers.**

## Using cURL to talk to APIs

APIs are the servers that usually return JSON instead of HTML.

Example:

```bash
curl https://api.github.com
```

The response:

* is not a webpage
    
* is structured data (JSON)
    

## GET and POST

For now, this will be the most common

### GET Request - Fetch Data

```bash
curl https://api.example.com/users
```

### POST Request — Send data to server

```bash
curl -X POST https://api.example.com/users
```

Don’t worry about flags yet. You might be thinking what is -X? It is a flag that is used to specify the type of request. So why didn’t you write in the GET request, because GET is the default request in cURL.

cURL is not about memorizing commands.

It’s about understanding how clients talk to servers.

---

And now, you know what cURL command is.

If you have any doubt or want to connect, feel free to drop a comment — I’d be happy to help.

Thanks for reading, and see you in the next blog!

Peace ✌️ and Happy Learning!
