Measuring "RESTfulness" with Richardson Maturity Model

When it comes to determining whether an API is RESTful or not, it's not an all or nothing matter. We can measure the "RESTfulness" using an already existing model or framework.

In 2008, Leonard Richardson proposed a system that was able to classify the maturity of a web service. This model is called the Richardson Maturity Model (RMM).

Leonard’s model describes three levels of service maturity based on a service’s support for URIs, HTTP verbs, and hypermedia. The model suggests that the higher the level of the service, the closer it is to being truly RESTful as each level inherits the one below it.

Level Zero Services: Plain Old XML

Level zero, also known as Plain Old XML (POX) is the most basic level of maturity. It states that the service will only have a single URI and that only a single HTTP method (usually POST) is used.

For example.

POST https://www.website.com/api/users will be used for both creating a user and retrieving a list of users.

This seems quite primitive don't you agree? Luckily, most modern web APIs I've seen are not at level zero.

A note here, the service does not have to be in XML, Plain old XML is just the name because JSON was not as popular in the 2000's as opposed to today.

Level One Services: URIs

The next level of service maturity states that many URIs are used as opposed to just one, but with only a single HTTP verb is still being used.

For example.

POST https://www.website.com/api/users will still be used for both creating a user and retrieving a list of users.

But we will have other URIs that map to other resources such as this.

POST https://www.website.com/api/users/1 will be used for retrieving a single user with the ID of 1.

Level Two Services: HTTP verbs

Now we are on to level two services, this is where most people are at. This is where multiple URIs are used to address different types of resources. Also, multiple different HTTP verbs (GET, POST, PUT, DELETE) are used on those exposed resource.

For example.

GET https://www.website.com/api/users will be used for retrieving a list of users.

GET https://www.website.com/api/users/1 will be used for retrieving a single user with the ID of 1.

POST https://www.website.com/api/users will be used for creating a user .

Level Three Services: Hypermedia

Now we have arrived at the final level, the level 3 service, where the web service contains hypermedia. If a service reaches this level, it has achieved all the other levels prior and has all inner resources being linked to one another in a coherent manner. At this level, the web service is considered "truly RESTFul".

We have already discussed this topic, so have a look and revisit the previous section to learn more about what hypermedia is.

Last updated