We have heard a lot of people talking about RESTful services. In order to explain it in the simplest way, we think it is a difficult task. This post aims at showing its most basic features and how it works.
In this post, we mainly refers in the original PhD dissertation of Thomas Fielding, considered as the first people proposed RESTful architecture.
Overview of RESTful services
While REST stands for Representational State Transfer, which is an architectural style for network based applications, it is primarily used to build lightweight, maintainable, and scalable Web services. In fact, we have approached with the older complex mechanisms such as CORBA, RPC or SOAP to connect between machines. Instead, the idea is to use simple HTTP to make calls between machines.
In some contexts, the World Wide Web itself, based on HTTP, can be viewed as a RESTful-based architecture.
RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.
REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.). Later, we will see how much more simple REST is.
Despite being simple, REST is fully-featured; there’s basically nothing you can do in Web Services that can’t be done with a RESTful architecture.
REST is not a “standard”. There will never be a W3C recommendataion for REST, for example. And while there are REST programming frameworks, working with REST is so simple that you can often “roll your own” with standard library features in languages like Perl, Java, or C#.
Features of a RESTful services
In general, RESTful services should have the following properties and features, which I shall address in detail:
- Uniform interface
- Links between resources
The server and client talk to each other via message propagation in the network. Clients send a request (aka. message) to the server, and the server replies it with a response (aka. message). Apart from the actual data, those messages also contain some metadata about them.
The uniform interface feature defines the interface between clients and servers. It simplifies and decouples the architecture, which enables each part to evolve independently. The four guiding principles of the uniform interface are:
As REST is a shorthand for REpresentational State Transfer, stateless is primary. It can be expressed simply
Links Between Resources
Cacheable communication protocol