What is REST API

Posted by Tushar Bedekar

Basic Description 

The Word REST stands for Representational State Transfer which is nothing but the technology that is generally preferred to more robust simple object access protocol (SOAP) Technology. Robust because it leverages less bandwidth usage and hence more suitable for internet usage.

An API ( Application Programming Interface ) for a website or an app is a code that allows two software programs to communicate with each other. It is the program that requests the hosted services.

An API is required when we want to consume the services that are running or hosted on the other web servers rather than installing the huge redundant hardware devices as per the demand that fulfills our purpose. This can be understood by the following examples:

As we are creating the weather app for the mobile device. Now the app needs to be dynamic, that is the weather needs to change as per the environment. That we need to have some sensors to collect the data for weather. Also, there can be one approach that we install sensors at different locations across the globe for collecting the data. This will be very costly if we go like this. The second approach can be contacting some vendor/service provider that can share the required weather information.

Now as our app is ready that means we have a ready design for use and we just need some data to make the response dynamic. We can get that data from the other hosted servers dedicated for this purpose using communication interfaces such as REST API`s.

Data Format 

Now the data we receive from other serves need to have some specific format that is structured so that it can be easily understood.In case of REST API, this data format can be JSON(JavaScript Object Notation) or XML(Extensible Markup Language).

Communication Using REST API 

In Our Example here we need weather information. That may contain data such as city name, humidity level, temperature etc. Now all this data can be contained within one object or specific to one object ( instance) here that object is "weather object" which is related to whether class. As we know that each and every object has some properties such as state, behavior etc. So if we need weather data we need to first set up a connection to the specific port of the server where a particular service is running and then we need to capture the state of the object weather which is nothing but the representational state. Now, this representational state is being transferred using some communication channel called an API.The state information can be transferred in JSON or XML format.



Read More
back to top