REST API

Edison Devadoss
2 min readFeb 2, 2020

--

Hi friends, in this article I will explain my understanding of REST API.

Google image

Acronym of the REST — Representational State Transfer.

Acronym of the API — Application Programming Interface. Set of rules to allow programs to talk each other. Developer create API on server it allow client and server communications.

What is Restful API?

REST API send data JSON or XML format. but traditional way server send data only HTML format. The problem is when you come to mobile App we do not want to render HTML page because we have already created UI design.

For example if you want to send data from server first create data as a object and send the values of the object.

Example of JSON data format

google image.

HTTP Method

Using below HTTP method client can communicate with server.

  1. GET
  2. POST
  3. PUT
  4. DELETE

Using four method we can make Create, Read, Update and Delete operations.

Constraints of REST API.

There are six constraints there. Out of six one is optional.

Client-Server Architecture.

The client-server architecture enables a uniform interface and separates clients from the servers. This enhances the portability across multiple platforms as well as the scalability of the server components.

Stateless

The requests sent from a client to a server will contain all the required information to make the server understand the requests sent from the client. This can be either a part of URL, query-string parameters, body, or even headers. Once the server processes the request, a response is sent to the client through body, status or headers

Cacheable

In order to provide a better performance, the applications are often made cacheable. This is done by labeling the response from the server as cacheable or non-cacheable either implicitly or explicitly. If the response is defined as cacheable, then the client cache can reuse the response data for equivalent responses in the future.

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.

Uniform Interface

To obtain the uniformity throughout the application, REST has the following four interface constraints:

  • Resource identification
  • Resource Manipulation using representations
  • Self-descriptive messages
  • Hypermedia as the engine of application state

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.

Thank you for reading. Have a great day.

--

--

Edison Devadoss
Edison Devadoss

Written by Edison Devadoss

Software Engineer / Full Stack Developer / JavaScript / React / React Native / Firebase / Node.js / Book Reader

No responses yet