RESTful APIs

December 10, 2023

REST = Representational State Transfer.

In a standard Client - Server architecture, Client send an request, Server sends an response. The response that the server send is in some form of representation. More often we see, JSON as the representation.

Everything in REST is a resource. Here resource means, an Entity in your system. For example, if you're building an Library Management System, the Books, the Students are resources.

REST is actually a specification on how Client should ask for things from Server and how Server should respond. It does not forces us to use a specific technology. It just suggest this is the way to do it. Let say you're building a Student Management System, here Student and Books are resources. Which we're exposing through HTTP endpoints. But the way student is stored in the DB is up to the developer, REST cannot enforce how you can store information on the database.

Difference Between HTTP endpoints and REST endpoints

All REST endpoints are HTTP endpoints, but not all HTTP endpoints are REST endpoints.

HTTP endpoints

REST endpoints

In the Library management system, a endpoint to create student in both HTTP and REST:

Similarly, to view an student details of _id = 1

Resources:

Get in touch

Do you have an Exciting project for me? Send an E-mail. Or want to have a general conversation? Feel Free to send a message on Twitter.

Drop an e-mail

iamkanhuc@gmail.com

Find me on