What is REST API???

Abdul Rehan
2 min readDec 12, 2020

REST determines how the API looks like. It stands for "REpresentational State Transfer".

REST AND HTTP ARE NOT SAME !!

HTTP is an application protocol.
REST is a set of rules, that when followed, enable you to build a distributed application that has a specific set of desirable constraints. It is a set of rules that developers follow when they create their API. One of these rules states that you should be able to get a piece of data (called a resource) when you link to a specific URL. Each URL is called a request while the data sent back to you is called a response.

Guiding Principles of REST

  • Client-server - By separating the user interface concerns from the data storage concerns. we improve the portability of the user interface across multiple platforms and Engrove scalability by simplifying the server components.
  • Stateless - Each request from the client to the server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.
  • Uniform interface — In order to obtain a uniform interface, multiple architectural constraints are needed to guide the behavior of components
  • Cacheable — Cache constraints require that the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. If the response is cacheable, then a client cache is given the right to reuse that response data for later, equivalent requests.
  • Layered system — The layered system style allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot “see beyond the immediate layer with which they are interacting.
  • Code on demand (optional) — REST allows client functionality to be extended by downloading and executing code in the form of Applets or scripts. This simplifies clients by reducing the number of features required to be pre Implemented.

RESOURCE

The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service, a collection of other resources, a non-virtual object (e.g. a person), and so on. REST uses a resource identifier to identify the particular resource involved in an interaction between components.

--

--