REST vs RPC

How it started and how they relate to each other

Dexter Awoyemi
2 min readAug 23, 2022

There’s a history of arguments about REST.

REST (Representational State Transfer) is a specific way to share data (using the specs for HTTP and URI), designed around client-server architectures.

This is a modified version of a concept that Martin Fowler refers to as the “Richardson Maturity Model (RMM)”, described by Leonard Richardson:

It’s a way to evaluate REST maturity (or RESTfulness). Each stage of maturity towards REST relies more on HTTP and URI specs than the previous.

Roy Fielding, who was involved in developing HTTP and URI (legend), introduced REST in his famous dissertation.

REST was designed to supersede RPC (not SOAP!).

RPC (Remote Procedure Call) is another way to share data, where an app calls a function in another app as if they shared the same execution environment.

Leonard Richardson’s model (RMM) describes the relationship between REST and RPC.

Today, only a minority of APIs include resource links from the root /, which allows the shape of the API to be machine-readable.

An example Swagger/OpenAPI specification using HTTP methods like GET combined with URIs like /pet

From a practical point of view, technical specifications like OpenAPI make APIs:

  • readable for humans
  • easy to achieve the second level of REST (multiple URIs, one HTTP method)

At this stage, the API is arguably discoverable. Adding links (e.g. using JSON-LD) is a relatively easy win in enabling machine readability.

However, the original definition given by Roy Fielding that required hypermedia is possibly the most challenging constraint of REST. It would require API designers to converge on the same definitions for data models, which just doesn’t seem to have worked.

The hypermedia requirement has failed to gain traction in the real world despite many efforts to develop the Semantic Web.

Funnily enough, the Semantic Web is about full discoverability and is also known as Web3. It was envisaged as a way for AI to understand and navigate the Internet.

The new Web3 relies on RPCs between nodes, better fitting a distributed computer like Ethereum since the network acts like a single application.

P2P connections using RPCs retreats from REST, which largely enabled the architecture of the modern Web.

One day, maybe decentralised ledger or blockchain RPCs will have their version of REST that makes interfaces between clients easier to use… and maybe they’ll culminate in arguments about how discoverable they should be.

--

--