Rest Basics and Key Concepts

Rest Basics and Key Concepts

What is REST?

The REST stands for REpresentational State Transfer

State means data

REpresentational means formats (such as XML, JSON, YAML, HTML, etc)

Transfer means carrying data between consumer and provider using the HTTP protocol

Key points about REST - REpresentational State Transfer:

• REST was originally coined by Roy Fielding, who was also the inventor of the HTTP protocol.

• A REST API is an intermediary Application Programming Interface that enables two applications to communicate with each other over HTTP, much like how servers communicate with browsers.

• The REST architectural style has quickly become very popular over the world for designing and architecting applications that can communicate.

• The need for REST APIs increased a lot with the drastic increase in mobile devices. It became logical to build REST APIs and let the web and mobile clients consume the API instead of developing separate applications.

REST – Architecture

Understanding Rest Architecture

REST Architectural Constraints

An API that has the following constraints is known as RESTful API:

Client-server architecture: The client is the front end and the server is the backend of the service. It is important to note that both of these entities are independent of each other.

Stateless: No data should be stored on the server during the processing of the requested transfer. The state of the session should be saved at the client’s end.

Cacheable: The client should have the ability to store responses in a cache. This greatly improves the performance of the API.

Uniform Interface: This constraint indicates a generic interface to manage all the interactions between the client and server in a unified way, which simplifies and decouples the architecture.

Layered System: The server can have multiple layers for implementation. This layered architecture helps to improve scalability by enabling load balancing.

Code on Demand: This constraint is optional. This constraint indicates that the functionality of the client applications can be extended at runtime by allowing a code download from the server and executing the code.

Rest Key Concepts

  • Resources

  • Sub Resource

  • URI

  • HTTP Methods

  • HTTP status codes

    What is Resource?

    What is URI?

    What is Sub-resource?

    Important HTTP Methods

    Important HTTP Status codes