REST API and its utility in Web Applications

Hello everybody, today I am going to share some recipe based on how you can expose a business logic as a REST API. Before even jumping into that I would like my viewers to get a clear perception of what does a REST api actually do and what is it.

So quick fact: REST stands for Representational state transfer. Ok now we know what REST stands for. Shall we figure out now what does it actually do ? ?

REST is a very popular architecture now a days 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. 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. Ok so what does decoupled architecture stands for. Decoupled architecture is a framework which allows two component to remain completely autonomous and unaware of each other, each component working in its own style but yet an intermediary which helps link the two components. This is what a REST api really help in achieving when working on decoupled architecture. So, basically a REST api consists of some specific values that can be in a format of XML or JSON, depends on what the function or program returns when the API is called.

Let me briefly explain you how a REST api is working.

Rest

So as you can see from the diagram we have two very different services serving two very different purposes. Now Front end service such as angular js which is a very popular js framework used now a days for web applications needs to communicate with the back end services so that it can avail all the required details from the back end. So how can this real world problem be resolved. You have the REST api come in picture here.

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. Only the required part that needs to be done is the backend logic needs to be exposed as URIs. I will help explain that in my next blog how can you expose business logic as REST apis.

So to gist up the advantages of using a REST api are as follows.

  1. Decouples consumers and producers.
  2. Stateless existence. By stateless I mean there is no record of previous interaction and each interaction request has to be handled, based entirely on the information that comes with it.
  3. Can be leveraged when handling requests from multiple systems or components.
  4. Platform independent.
  5. Can be leveraged to process data in both XML and JSON format.
  6. Highly scalable, reduces server load making failover easy.

Well, this is the basic whereabouts of REST API. I will write down a blog on how can you expose business logic as a REST API and how can that REST API be leveraged.




Soumyajit Basu

Soumyajit is 5+ years experienced Software professional with his prime focus on automation technologies based on quality development and takes interest in the CI/CD processes. He provides help in developing the QA process in an organization with his skills in automation for the web platform. His focus is on improving the delivery process for an ongoing project and connects the dot to help out with a successful deployment. He has experience in working on analytics, e-commerce, and the ad-tech domain.

Besides being a professional he takes an immense interest in learning new skills and technologies. He is a research guide author/writer at Dzone and Web Code Geeks. He also maintains a blog platform of his own where he likes to keep up his technology junks.

Leave a Reply

Your email address will not be published. Required fields are marked *