In my previous post, No REST for the Wicked, I gave my two cents on REST and the underlying principle of HATEOAS (Hypermedia As The Engine Of Application State). In my opinion, HATEOAS is applicable to more than just REST architecture. The internet trolls may argue that I’m using the term too broadly, but HATEOAS introduces a number of concepts that are worth exploring in their own right.
Where Do We Start?
In his Richardson Maturity Model, Leonard Richardson summarized three levels of pre-requisites for REST:
- Resource-Oriented Structure
- HTTP Verb-Driven Actions
- Hypermedia Controls
In his article on Richardson’s model, Martin Fowler introduces HATEOAS in the third stage as a means of enabling discoverability in a web service. While his description is correct, it’s focussed on supporting level 3 of Richardson’s model. The concept is actually broader than that and has already entered the conversation in level 2 with HTTP verbs. Fowler did, however, have good reason for waiting until level 3 to bring up HATEOAS. In practice, this is the point where building a RESTful architecture gets difficult and many attempts go outside the lines of Roy Fielding’s original definition of REST.
So What Now?
Going forward, I’ll be exploring different practical use-cases for leveraging hypermedia in web services. In the mean-time, for an introduction or refresher, skim through these Wikipedia articles on REST and HATEOAS. For a more in-depth look at hypertext-driven constraints, read Roy Fielding’s blog post REST APIs must be hypertext-driven.