REST and RPC Not every service that is exposed over HTTP is compliant with the REST constraints. Sometimes one can find services, which are advertised as being RESTful, but in reality, they follow the RPC style. In fact, there may even be a grey zone between REST and RPC (see article on “What is API-Design”), when a service implements some features of REST and some of RPC. The Richardson Maturity Model can be used for determining the degree to which services are RESTful. The following levels are defined:

Richardson Maturity Model

According to its definition, the REST style requires level 3, which is in fact HATEOAS. I have studied a well-known API that does a decent job in following the HATEOAS principle.

However, typically people speak about REST services, even if only levels 1 or 2 are reached. REST at levels 1-2 is sometimes called “pragmatic REST” or “REST-like APIs”. Here are a couple of simple, practical tricks to determine if a service is not RESTful:

  • If the name of the service is a verb instead of a noun, the service is likely RPC and not RESTful.
  • If the name of the service to be executed is encoded in the request body, the service is likely RPC and not RESTful.
  • If the back-button in the web-application does not work as expected, the service is not stateless and not RESTful.
  • If the service or website does not behave as expected after turning cookies off, the service is not stateless and not RESTful.

Learn all about RESTful API Design in my new book.

REST-like APIs with the Richardson Maturity Index

Also published on Medium.

Tagged on: