REST API is a word you might’ve heard so many times if you are a programmer, more specifically a web developer. But, what exactly is it?

What is an API?

An application program interface (API) is a set of routines, protocols, and tools for building software applications. Basically, it allows applications (webpages, softwares, etc)to communicate with each other.

API serves as a medium for a webpage to send a ‘request’ for certain data and consequently for the server to return the ‘response’ i.e the requested data from the database.

What is a REST API?

It stands for “Representational State Transfer”.

The first thing to understand is that API is the superset while REST API is the subset. While API is a broad term, REST API is a specialization. It is a set of rules or guidelines to build a web API. There are many ways to build a web API, and REST is a standard way that will help in building it faster and also for third parties to understand it better.

The working of REST API essentially revolves around two fundamental functions.

  • Sending a request from the client to the server.
  • Receiving a response from the server and delivering it to the client.

Understanding REST Requests.

Endpoint: The first component of a request is the endpoint. It is the URL we requested for.

Methods: Besides fetching the data, it can even add to the data, modify the data or delete certain parts of the data. All of these come under the request methods.

The basic four operations that any models should be able to do are the CRUD operations. Similarly, our REST API uses HTTP equivalents of these operations on data. Which are —

Headers: API headers are like an extra source of information for each API call you make. Their job is to represent the meta-data associated with an API request and response. They are useful in resolving any issue with the API should they come up. Headers provide information about —

  • Request and Response Body
  • Request Authorization
  • Response Caching
  • Response Cookies

Body: The body also called the data holds the information we want to send to the server. The body format is specified by theContent-Type.


A response is something returned by the server as an answer to the request. It can be of any media type. The most common are XML and JSON . This can be specified by using the Content-Type attribute in the header.

Tags: , , , , , , , , , , , , , , , , , , , , , ,