Skip to main content

Command Palette

Search for a command to run...

Getting Started with cURL

Published
Getting Started with cURL
M

I believe writing makes learning easier so I share simple Tech notes with diagrams

Introduction -

Before we talk about cURL, let us take one small step back. Every time you open a website, your browser is talking to a server somewhere on the internet. The server listens, understands the request, and sends something back a webpage, data, or an error.

cURL is simply a way to have that conversation from the terminal without a browser.

What Is cURL ?

cURL is a command-line tool that lets you send requests to a server and see the response. Imagin it like Browser → talks to server with a UI but cURL → talks to server using text commands.

With cURL you can say “Hey server give me this page” or “Here’s some data please save it” And the server replies directly in your terminal.

Why Programmers Need cURL -

Programmers use cURL because it is Simple, Available on almost every system and honest (no hidden behavior like browsers)

Common uses:

  • Testing APIs

  • Checking if a server is responding

  • Debugging backend issues

  • Learning how HTTP actually works

If you understand cURL, you understand how programs talk over the internet.

Making Your First Request Using cURL -

Let’s start with the simplest possible example. Open your terminal and run:

curl https://example.com

What just happened?

  • cURL sent a request to the server

  • The server responded with HTML

  • cURL printed that response in your terminal

You just fetched a webpage without using a browser.

Understanding Request and Response -

Every HTTP conversation has two parts:

1. The Request

This is what you send to the server —>Where you want to go (URL) & What you want (GET or POST)

In the example:

curl https://example.com

You are saying that Please GET this page

2. The Response

This is what the server sends back —> Status (success or error) & Data (HTML, JSON, text)

If the request is successful, you usually get:

  • Status: 200 (OK)

  • Some content printed in your terminal

cURL doesn’t decorate the response it shows you the raw result.

Introducing GET and POST -

For now you only need to know two methods

  • GET

  • POST

GET is used to fetch data, Example:

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

This means Give me the users.

POST is used to send data, creating something, sending form data and submitting information to an API. We won’t go deep yet just know that POST exists and is used to send data.

Using cURL to Talk to APIs -

APIs are just servers that return data instead of webpages. Example:

curl https://api.github.com

Instead of HTML you will see JSON. This is extremely useful when:

  • You are building backend services

  • You want to test an API quickly

  • You don’t want to write code just to check a response

cURL is often the first tool developers reach for when debugging APIs.

Common Mistakes Beginners Make with cURL -

  1. Expecting a pretty output - cURL shows raw data & No formatting, no colors, no UI. That’s a feature, not a problem.

  2. Using too many flags too early - cURL has many options, but you don’t need them at the start. Begin with Simple GET requests & Understanding responses. Depth comes later

  3. Confusing browser behavior with cURL - Browsers add headers, cookies, and extra logic. cURL does exactly what you tell it nothing more. That’s why it is trusted for debugging.

Conclusion -

cURL is not a “tool to memorize”.

It’s a conversation starter with servers. Once you’re comfortable with:

  • Sending a request

  • Reading a response

  • Understanding what the server says back

You’ll feel much more confident working with:

  • APIs

  • Backend systems

  • Networked applications

Start simple and use cURL often. The rest will come naturally.