Table of contents
1.
Introduction
2.
Richardson Maturity Model
3.
Levels of the Richardson Maturity Model
3.1.
Level 0 - The Swamp of POX
3.2.
Level 1 - Resources
3.3.
Level 2 - HTTP Verbs
3.4.
Level 3: Hypermedia Controls
4.
Frequently Asked Questions
4.1.
What does Richardson's Maturity Model describe?
4.2.
Which is the preferable format to expose data using RESTful?
4.3.
What does Richardson's maturity level most RESTful API succeed at achieving?
4.4.
What is the highest level of the Richardson Maturity Model?
5.
Conclusion
Last Updated: Mar 27, 2024

Richardson Maturity Model

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

So far, in the previous lessons, we discussed how to design an API. But, Are we in a position to say this API is fully RESTful? Now, the question may arise, how do we know whether the API is RESTful? Well, there is one way to know by a model developed by Leonard Richardson named as Richardson Maturity Model.

So, are you ready to understand the Richardson Maturity Model? 

Richardson Maturity Model

Richardson Maturity Model

The Richardson Maturity Model breaks down the concepts into three levels. Every REST API belongs to one of these. 

LEVEL 3

LEVEL 2

LEVEL 1

The model also defines level 0, which is not a RESTful API. Hence, there are four different levels in Richardson Maturity Model, one is not for RESTful APIs, and the other is for RESTful APIs. 

Note: It is optional for every API to score high as per the model but while designing an API, at least know where you stand and try to make it better if possible.  

Now, let us discuss the different levels of the Richardson Maturity Model: 

Levels of the Richardson Maturity Model

The four levels are-

  • Level 0: The Swamp of POX
  • Level 1: Resources
  • Level 2: HTTP Verbs
  • Level 3: Hypermedia Control

Levels of Richardson Maturity Model

Let us start discussing the LEVEL 0: 

Level 0 - The Swamp of POX

To understand Level 0, you must be familiar with the basics of SOAP web service

To recap, the way the SOAP web services generally works is that there is a URL known as the EndPoint where the service is exposed. And that URL receives all requests from the Client. Now, how does it know what to do, which operations to perform, or how does a client tell it how to do it differently, like deleting or updating the content? Well, that happens in the message sent to the common URI

The message contains:

  1. Operation needs to be performed
  2. Data that is needed to operate

For example: The XML here can create a message. 

level 0

<create-message>
    <message-content> Hey Ninja. How are you doing? </message-content>
    <message-author> Alisha </message-author>
</create-message>


So, there is a create-message portion in the request itself, which has the Action. And the delete common request would be sent to the same URL. 

As you can see below: there is a delete-comment in the request. 

<delete-content>
    <message-id> 89 </message-id>
    <comment-id> 2 </comment-id>
</delete-content>


This is how the single URL knows how to perform different operations. Since the action is part of the message, the same HTTP method can be used for each operation because all the operation details are in the request body. 

level 0

It is often called the SWAMP of POX, which refers to using common OLD-XML or parks to define everything the operation requires. No HTTP concepts are leveraged for communicating between the server and the client. Since everything is in the XML, HTTP concepts are not used. 

This is something you should not do while designing an API. If you were to refine this model and introduce a concept of resource URI, you would reach LEVEL - 1. 

Level 1 - Resources

It is the starting level of the RESTful API. The earlier level isn’t even considered REST according to the Richardson Maturity Model. 

Level 1 tackles complexity by breaking down huge service endpoints into multiple endpoints. Message requests go to one URI, comment requests go to another URI, profile requests go to another URI, and there will be information about the operation inside these requests. 

So, the message still contains what operations to perform, but you split the path to the right resource URI. 

level 1

If you take the next step and introduce different HTTP methods for these operations, you reach LEVEL 2 in the Richardson Maturity Model. 

Level 2 - HTTP Verbs

An API on level 2 uses standard HTTP methods like GET, POST, PUT and DELETE to perform different operations on the resource URIs. The URI specifies the resource being operated upon, and the HTTP method determines what that operation is. 

You can use the following predefined HTTP Verbs according to your usage.

Verbs

Safety and Idempotency

Usage

GET YES/YES It is used to retrieve information.
POST NO/NO It is used to perform various actions on the server, like creating a new resource, updating an existing resource, etc.
DELETE NO/YES It is used to delete a resource.
PUT NO/YES It is used to update or delete a current resource or create a new one with a URI specified by the client.
HEAD YES/YES It retrieves the same headers as the GET response but without anybody in the response.
OPTIONS YES/YES It is used to find the list of HTTP methods supported by any resource.
TRACE YES/YES It is used for debugging, echoing back headers it has received.

There also needs to be the use of the HTTP status codes and the right HTTP methods

An HTTP status code is a server response to a browser request. When you visit a website, your browser sends a request to the site's server, and the server responds with a three-digit code: the HTTP status code. 

Level 3: Hypermedia Controls

Finally, LEVEL 3 is when you implement HATEOAS ( HATEOAS stands for Hypermedia as the Engine of Application State and is a component of RESTful API architecture and design. Hypermedia refers to content that includes a link to other types of media such as images, movies, and text. It is a feature of the REST application that sets it apart from other network architectures.), the responses with links that control the application state for the client. 

On the other side, the client isn’t aware of the different API URIs that would be sent to them in the response. An API that adheres to the stated points is considered at LEVEL 3 of the Richardson Maturity Model. 

Now, let's see some FAQs related to the Richardson Maturity Model.

Frequently Asked Questions

What does Richardson's Maturity Model describe?

Richardson Maturity Model is a four-level scale that indicates the extent of API conformity to the REST framework. 

Which is the preferable format to expose data using RESTful?

We prefer to use JSON as the Format for Sending and Receiving Data. However, In the past, we used XML and HTML formats to accept and respond to API requests.

What does Richardson's maturity level most RESTful API succeed at achieving?

The Richardson Maturity Model knows four levels (0-3), where level 3 designates a truly RESTful API.

What is the highest level of the Richardson Maturity Model?

Level 3 is the highest level of the Richardson Maturity Model as it uses all three, i.e., URIs, HTTP, and HATEOAS.

Conclusion

We have thoroughly discussed the Richardson Maturity Model, in which we covered all four layers of this Model with their examples.

After reading about the Richardson Maturity Model, do you feel excited to read/explore more articles on REST API? Don't worry; Coding Ninjas has you covered. See How to Build a REST APIHandling requests in RESTFul APIGET vs POST RequestsAPI Reference, and 4 Stages of AR Maturity Model to learn.

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem Design, and many more! 

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

Live masterclass