Labs ICT
Pro Login

REST API Basics

What REST is and why it matters.

What Is REST?

REST stands for Representational State Transfer. It's not a protocol or a library — it's an architectural style for designing networked applications. Think of it like a set of guidelines that help different systems talk to each other over HTTP.

The beauty of REST is its simplicity. It uses the standard HTTP methods you already know, and it works with data in formats like JSON. Most modern APIs you interact with — from Twitter to GitHub — follow REST principles.

HTTP Methods

REST APIs rely on four core HTTP methods to perform operations on resources. Each method maps to a specific action:

GET retrieves data, POST creates new resources, PUT updates existing ones, and DELETE removes them. It's like the CRUD operations you know from databases, but expressed over HTTP.

GET    /api/users       → fetch all users
POST   /api/users       → create a new user
PUT    /api/users/1     → update user with id 1
DELETE /api/users/1     → delete user with id 1

Stateless Communication

One of REST's core principles is statelessness. Every request from a client to the server must contain all the information the server needs to understand and process it. The server doesn't remember anything between requests.

This might sound limiting, but it's actually what makes REST scalable. Since the server doesn't hold onto session state, it can handle millions of requests from different clients without getting confused about who's who.

JSON as the Data Format

While REST doesn't mandate a specific data format, JSON has become the de facto standard. It's lightweight, human-readable, and maps naturally to objects in most programming languages.

In Spring Boot, Jackson handles the conversion between Java objects and JSON automatically. You define your data classes, and the framework takes care of the rest — no manual parsing needed.

Try it Yourself →