REST API

Within the computer industry it is sacrilege to call a technology to be a game changer. The game changers are claimed everyday but seldom live more than a couple of years.

Some game changers, have been true to their name and have fundamentally changed the IT industry. This include microprocessors, which revolutionised and changed the direction of computer industry by bringing the ability to compute to the common masses. Another technology that had a similar impact is RDBMS. RDBMS removed the guesswork of how to choose a database and became and remained a standard for years to come. The internet, the web and other technologies have made similar impact.

This brings us to a little known PhD thesis “Architectural Styles and the Design of Network-based Software Architectures” by Roy Fieldings which came out in 2000. This dissertation defined a framework for understanding software architecture via architectural styles and demonstrated how styles can be used to guide the architectural design of network-based application software.

The web and http by its very nature are scalable, reliable and simple to use. Further the hardware, network and design by its very nature exists. It is only obvious to expose services over web using web standards. This is simply REST.

The author derives an analogy between REST and RDBMS, both have identical approach towards simplicity and provide similar set of problems. The problem of computer science has always been that of modelling data, algorithms and processes are usually a solved problem.

In design of a database it is normalization and creation of entities that is more of an art form while CRUD operations are standardised. On similar lines it is design of entity structure that is the complex piece; formation of nouns in the design space that is a challenge, once URI’s and resource representation is fulfilled, the remainder is simple operations like CRUD of a database.

It is the author’s opinion that REST is successful for the same reasons RDBMS are, they bring standardization towards sharing resources and processes. It naturally is decentralised and scales as web scales. Further most IT infrastructure allows http(s) hence REST needs no special privileges.

REST is a simple architecture pattern with most client systems allowing http access no special libraries or structures. It is allowed on both mobile and web leading to ease of consumption.

Some design principles of true REST are difficult to achieve for example from the original paper of Roy Fielding-

 

“communication must be stateless in nature, as in the client-stateless-server (CSS) style of Section 3.4.3 (Figure 5-3), such that each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server.”(sic)

Most applications have a concept of a session and not all requests contain information for fulfilment.

Many clients do not allow PUT and DELETE verbs and some firewalls disallow them, which required creative solutions (for example X-HTTP-METHOD-OVERRIDE).

Further workflows don’t fall cleanly into the process of REST whose primary purpose is to expose resources over web.

As the article started with REST being a game changer, the author believes the same to be true and primarily because it has such a large usecase for implementation.