If you’ve ever wondered how websites, mobile apps, and online services seamlessly exchange information, this quick guide will help you understand the core building blocks — HTTP, REST, and JSON. By the end, you’ll know how these technologies work together to power the modern web.
The diagram below shows how devices like phones, laptops, and servers communicate over the web — exchanging information in structured formats such as JSON.
Every connected device communicates through the web using shared data formats like JSON:
Let’s explore it step by step.
Step 1: Understanding HTTP — The Foundation of the Web
HTTP (HyperText Transfer Protocol) is the foundation of online communication. Whenever you open a website, your browser (the client) sends a request to a server, which then processes it and sends a response back.
Here’s what happens in simple terms:
- You (the client) send a request by entering a URL or clicking a link.
- The server receives and processes the request.
- The server responds with the requested data and a status code.
- Your browser renders and displays the webpage.
To specify what action you want to perform, HTTP uses methods. The most common ones are:
- GET: Retrieve data (e.g., open a webpage).
- POST: Send or submit data (e.g., a form).
- PUT: Update existing information.
- DELETE: Remove data or resources.
HTTP status codes indicate the result of your request. Key examples include:
- 200 OK: The request was successful.
- 404 Not Found: The requested page doesn’t exist.
- 500 Internal Server Error: There’s an issue on the server side.
To visualize how web layers interact, think of APIs as the bridge between what users see and what happens behind the scenes.
APIs connect the frontend user experience with backend data and logic:
Step 2: REST APIs — How Systems Communicate
REST stands for Representational State Transfer — a stateless design style for building scalable web APIs. “Stateless” means the server doesn’t store any information about previous requests; every interaction is handled independently.
REST is built on top of HTTP, using the same methods such as GET, POST, PUT, and DELETE to perform operations like retrieving, adding, updating, or deleting data.
API means Application Programming Interface — a set of rules that allows two systems to communicate with each other. When an API follows REST’s principles and constraints, it’s called a RESTful API.
A REST API typically uses JSON (though it can also use XML) to send and receive data, making it lightweight and easy for different systems to understand.
In short, REST defines how systems talk to each other over the web — clearly, consistently, and without keeping track of past conversations.
The following diagram illustrates how multiple clients can communicate with a REST API independently — without the server storing any session information.
REST APIs are stateless — each client request is handled separately:
Step 3: JSON — The Language of Data Exchange
Once the server processes your HTTP request, it sends data back in a format called JSON (JavaScript Object Notation). JSON represents information using simple key-value pairs that are easy for both humans and machines to read.
JSON acts as the shared language that unites frontend and backend systems:
Example JSON object:
{
"id": 1,
"firstname": "Nikas",
"lastname": "Bandaru",
"email": "nikasb@gmail.com"
}
JSON is lightweight, language-independent, and universally supported — which is why over 90% of modern REST APIs use it for sending and receiving data.
Here’s a simplified example of an HTTP request and response:
HTTP Request:
const httpRequest = {
host: "localhost",
port: 8080,
method: "POST",
path: "/payments",
headers: {
"content-type": "application/json",
"content-length": 51
},
body: { data: "this is a piece of data in JSON format." }
};
HTTP Response:
const httpResponse = {
statusCode: 200,
headers: {
"access-control-allow-origin": "https://www.google.com",
"content-type": "application/json"
},
body: "{}"
};
Summary: How HTTP, REST, and JSON Work Together
- HTTP is the foundation — the protocol that enables communication over the web.
- REST defines how systems interact with each other using HTTP.
- JSON is the lightweight format that carries data between systems.
Together, they make the internet function seamlessly — enabling websites, mobile apps, and services to communicate effortlessly.
Now that you understand how these technologies work together, try exploring API tools like Postman or writing a simple fetch() request to see this interaction in action.