Rest API

What is Rest API?


REST means REpresentational State Transfer. REST API is one of the most popular web services accessible these days. It Provides architecture constraints such as stateless communication and cacheable data. They permit the client’s browser to communicate with the server using the HTTP standard methods and provide the current state of the database.

Origin of REST


REST was introduced in 2000 by a man of science Roy Fielding as a part of his Ph.D. treatise. Fielding was conjointly deeply concerned within the early development of the WWW and was a principal author of the world HTTP specification.


How does REST work?


In REST architecture everything is a resource and this can be text, XML, JSON, etc these resources should support common HTTP operation which will be identified by IDs (URL or URI). When the client makes a request to REST API the server will transfer a representation of the state of the requested resource.

Making Request

The client makes a request to get or modify data on the server. Request contains :

HTTP verb – informs which kind of operation wants to perform like

  • GET: get specific resource (by id) or a collection of resources
  • POST: create a new resource
  • PUT: update a specific resource (by id)
  • DELETE: remove a specific resource by id


Header and Accept – information about the request which includes MIME accept-type like text/html, application/json, image/jpeg, etc.

Path – path to a resource (e.g. )

Message body – optional message data

Server Response
The server will respond based on the request coming from the client. Response contains:

Header and Content-type – inform the client which type of data server is

Response code – informs the client about the status of the operation.
common response codes are:
◆ 200 – OK
◆ 201 – CREATED
◆ 404 – NOT FOUND

Response body – response data

Example of request-response:

MicrosoftTeams-image (2)

Jainam Doshi is pursuing his MCA from GLS university. He is fond of coding, photography, playing cricket, and traveling.
Jainam Doshi, Intern at GlobalVox. | Posted on: March 3, 2022