The Richardson Maturity Model
The Richardson Maturity Model (RMM) describes the level of friendliness, or how close your web services are to the REST architecture. In other words, how far your API is from the benefits of REST:
- scalability
- performance
- loose coupling
- consistency/maintainability
The RMM is divided into 4 levels (0 - 3), where 3 is the maximum score: a truly RESTful API.
Level 0 - Tunnelling
This level includes all those services that use only one method of the protocol, and only one entry point. In HTTP, this means sending requests and responses to the service using one of the verbs (usually POST) to an URI. Examples of Level 0 web services are SOAP and XML-RPC.
Level 1 - Resources
If a web service provides different end points for different resources, then we can say that it meets level 1 of RMM. For example, instead of having a unique end point: http://server.org/users
, the service provides different end points for different users: http://server.org/user/1
http://server.org/user/2
.
Level 2 - Verbs
This level brings protocol verbs to the table. Talking about HTTP, these are GET, POST, PUT, DELETE, OPTIONS, HEAD, TRACE, CONNECT and PATCH. That means that the web service uses protocol properties to interact with resources. For example, a GET request to http://server.org/user/1
retrieves information about user one, and a DELETE request to http://server.org/user/1
removes the resource.
Another feature included in level 2 are response codes. These codes provide information about the status of a request. For example, 201 when a new resource is created.
Level 3 - Hypermedia controls
Finally, at level 3 the API includes HATEOAS in order to discover which next actions can be requested for a client. For example, after a POST request to http://server.org/user/1
which creates a new resource, the response will include a link to a GET http://server.org/user/1
request. This means that retrieving the created user is one of the next valid actions for the client, and the provided link is the way to trigger it.
For further reading: