REST API and its utility in real Web Applications

By Team Srijan Apr 5, 2016
Quick fact: REST stands for REpresentational State Transfer, now let’s find out what it actually does.

REST is a very popular architecture nowadays for development and is an approach to communications between two very different components that is often used in the development of Web Services. Besides, REST does not leverage much bandwidth which makes it a better fit for use over a network.

This makes REST a better fit over SOAP because unlike SOAP you do not have to create a server and a client. In case of SOAP you have to separately create a server program to serve data and a client program that would request the data.

REST’s decoupled architecture and lightweight communications between a producer and a consumer makes it popular to build APIs.

What does decoupled architecture mean? Decoupled architecture is a framework which allows two components to remain completely autonomous and unaware of each other. Each component works in its own style while an intermediary helps link the two components. This is what a REST api really helps in achieving when working on decoupled architecture. Basically, a REST api consists of some specific values that can be in a format of XML or JSON, depending on what the function or program returns when the API is called.

Let me briefly explain how a REST api works.

how a REST api works.

As you can see from the diagram we have two very different services serving two very different purposes. Front end service such as AngularJs, which is a very popular js framework used nowadays for web applications, needs to communicate with the back end services so that it can avail all the required details from the back end. This is how REST api comes into the picture.

REST api helps expose the business logic in the back end to the front end services. It would just give the front end service a required URI (for example localhost:8080/MyApplication/testapp/ftocservice) from which the front end service can fetch the required data. All that needs to be done is that backend logic should be exposed as URIs.

So to sum up, the advantages of using a REST api are as follows:

  • Decouples consumers and producers

  • Stateless existence, which means there is no record of previous interaction and each interaction request has to be handled based entirely on the information that comes with it

  • Can be leveraged when handling requests from multiple systems or components

  • Platform independent

  • Can be leveraged to process data in both XML and JSON format

  • Highly scalable and reduces server load making failover easy

These are the basics of REST API. Look out for my next blog on how can you expose business logic as a REST api and how can that REST api be leveraged.

Subscribe to our newsletter