RESTful and RESTless Web API

REST stands for REpresentational State Transfer. REST is a web standards based architecture and uses HTTP Protocol. It revolves around resource where every component is a resource and a resource is accessed by a common interface using HTTP standard methods.

In REST architecture, a REST Server simply provides access to resources and REST client accesses and modifies the resources. Each resource is identified by URIs/ global IDs. REST uses various representation to represent a resource like text, JSON, XML.

RESTful Web Services

RESTful web service is an application that conforms to the REST architectural style that provides interoperability between computer systems on the internet. RESTful web services work with Resources instead of Operations. The response to the request by a client itself is a representation of the resource present on the server. This explains why the service is called representational.

Web services based on REST Architecture are known as RESTful web services. Any communication between client and services are using URI (Unified Resource Identifier) over HTTP protocol. These webservices uses HTTP methods to implement and locate the concept of REST architecture.

RESTful web service architecture works on six basic constraints which encourage design on loosely coupled application:

1.) Uniform Interface – This ensures that all the resources are accessible via a consistent interface makes it easy to understand things. Hence all the resources can be accessed in the same way as the GET method. We can use HTTP GET to call the resource location.

2.) Stateless – This means all the information that the server needs to give the response is supplied with the request itself. A REST API would always give consistent results for the same interface, it would not take or assume state based on any previous call that has been made.

3.) Fast – REST APIs should have the capability to cache requests-responses for faster handling of calls which comes in very handy whenever a common set of data is required by all the clients from the server.

4.) Language and Platform Independent – This implicates that the REST APIs can be coded in any language, be it JAVA REST API, Python, C++ etc. Since this is just an architectural style, we can code RESTful web services APIs in the language of our choice.

5.) Client-Server – By this, the client user interface becomes independent and separated from the data stored on the server. This increases the scalability by simplifying server components and separation allows the components to evolve independently.

6.) Different Data Formats – REST web APIs can communicate via popular data formats, be it JSON, XML, plain text, PDF or even HTML. However, people mostly prefer either to communicate via JSON or XML.

Resources are the fundamental concept in RESTful web services and REST API. Each resource has its own unique URL. Different methods can be executed on resources via their URL. The common verbs which are used to locate and update the resources in server are:

RESTless Web Services

RESTless is an alternative to REST frameworks. They are generally known as Simple Object Access Protocol (SOAP) which sends an XML request over the internet using HTTP protocol and receives an XML response. Every application that sends SOAP requests has a Web Services Description Language (WSDL) file. It represents all the methods available in the web service & contains the request and response types.

In a SOAP design, it is required to identify the Service and the Operations services separately. This may cause the operations be named differently by different developers. As a result, a client needs to know the service functions completely if they need to work with that service. In case of SOAP services, when you call a service operation from client, the dispatcher in the server side will first de-serialize the SOAP message, and then it identifies the action from the message to be performed. Since actions are mapped with the service methods, once an action is identified, the dispatcher will call the operation.

The comparison below will further clarify the difference between RESTful & RESTless web services:

Further reading: Wikipedia, Medium
Image Source: Pediaa

Leave a Reply

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