REST Architecture – What are REST APIs?

By | February 17, 2023
REST Architecture
Fig 1 – REST Architecture

REST stands for REpresentational State Transfer. REST Architecture a software architectural design paradigm which provides a standard way of communication between different computer systems over the web. The computer system that compliant to REST are called Restful systems. These restful system communicate with each other using web-services called Restful Web Services or Restful APIs. These web services uses HTTP(Hypertext Transfer Protocol) to communicate with each other.

A restful system comprises of following two major components:

Clientwho Request for a resource from the server
Serverwho processes the request from the client and returns a Response

REST Architecture Constraints

In designing a restful service, we need to make sure that we follow the industry standards. There are six constraints which one needs to keep in mind while designing a restful system or services.

  1. Client-Server
  2. Stateless
  3. Cacheable
  4. Layered Architecture
  5. Uniform Interface
  6. Code On Demand


The RestFul(web-services or api’s) systems must follow the client-server architecture which means the implementation of the client and the server must be independent to each other. Client and Server must be modular and separated as long as they follow a standard format of communication between each other, which means the client side code can be changed without affecting the operations of server and server side code can be changed without affecting the operations of client. The client and server must act as independent entities. For example, Client maybe written in React and the Server side is implemented with Java.


The Restful system must be stateless. This means the server and the client must not worry or aware of each other states. This will help them to undergo any data or message exchange without knowing or worrying about the previous data or message.

Note: The server should be stateless .i.e., we should not store any data(state) over the server. The state(cookies) maybe stored at clients end(web-browser).


The Restful system can cache data to the clients end, this will reduce the client-server interaction and improve the system scalability and performance. We should also handle and manage the cache effectively to prevent the system to store inappropriate or unstable cache.

Layered Architecture

The Restful system must follow layered architecture. In layered architecture, the application is composed of different layers and these layers does not know about each other except to the immediate joining layers to them. It is possible that there maybe multiple intermediate servers between the client and the end-server. These intermediate servers are introduced to improve the server availability by enabling load balancing.

Uniform Interface

In a Restful system, we use an interface to decouple the client and the server. The uniform interface act as a key component which differentiate between the rest and non-rest api’s. The uniform interfaces is a contract between the client and the sever which uses an standard to exchange the data between the client and the server. As it uses a standard to communicate over the internet we should keep 4 major guidelines while designing the uniform interface.

Four major guidelines to design uniform interface are following:

  1. Resource Identification
    • The requested resources must be identified using the URI(Uniform Resource Identifier). The resources at the server side(backend- files or database tables) are completely different in representation then those which are returned to the client side(frontend- JSON or XML).
  2. Manipulation of Resource by representation
    • The resources may have some metadata attached to them and when client holds that resource they may modify or delete some resources on the server, if they have appropriate permission.
  3. Self-descriptive Message
    • The resource should contains all the information which will be required by the client to understand it. There should not be any additional information should be sent through another request to understand the resource. For example, when we hit the browser will add https:// by default we do not need to specify it explicitly.
  4. HATEOAS – Hypermedia As The Engine Of Application State
    • The resources returned from server should be in hypermedia format .i.e., hyperlink within the hypertext. The response contains response code, headers and the body of the resource.

Code On Demand

It is an optional constraints to REST system. Code on demand basically means that server can also provide executable codes to the client. For example, Java servlets, server side scripting etc.

Leave a Reply

Your email address will not be published. Required fields are marked *