The Great API Debate: Are Most 'RESTful' APIs Just RPC?

An essay gaining traction among developers argues that many APIs claiming to be RESTful are actually Remote Procedure Call (RPC) endpoints in disguise. The author suggests that founders building API-first products should prioritize usability, clear documentation, and predictability over dogmatic adherence to a specific architectural style. Another post warns that even simple health endpoints can introduce complexity and security risks if not designed with discipline.

- The distinction between REST and RPC often centers on how they structure communication; REST is resource-centric, focusing on nouns and data representation, while RPC is action-centric, focusing on verbs or specific operations to be performed. A common way to evaluate an API's adherence to REST principles is the Richardson Maturity Model, which outlines four levels, starting from basic RPC-style calls (Level 0) to the highest level (Level 3) that incorporates hypermedia controls (HATEOAS), allowing clients to dynamically navigate the API. - Modern RPC frameworks like gRPC often show significant performance advantages over REST, with some benchmarks indicating gRPC can be up to 8 times faster with message sizes 60-80% smaller than JSON serialization. This performance gain is largely due to gRPC's use of HTTP/2 and Protocol Buffers, a binary serialization format, in contrast to REST's typical reliance on text-based formats like JSON over HTTP/1.1. - Under heavy loads, the performance difference can be even more pronounced. In one experiment with 100 concurrent requests, a gRPC-based system processed 3.7 times as many orders as a REST-based one. gRPC's support for bidirectional streaming and multiplexing over a single TCP connection contributes to lower latency, a key advantage for microservices and real-time applications. - While REST is often favored for public-facing and web browser-compatible APIs due to its simplicity and use of standard HTTP methods, gRPC is frequently chosen for high-performance internal microservices communication where efficiency and strongly-typed contracts are critical. The choice between them depends heavily on the specific use case, balancing performance needs against the broader compatibility and human-readability of REST. - Regardless of the architectural style, a focus on developer experience is paramount for API-first products. This includes providing clear and interactive documentation using tools like OpenAPI or Swagger, offering meaningful error messages, and designing intuitive, consistent resource paths that avoid verbs in the base URL. - Key design practices that enhance usability for developers include support for pagination, filtering, and sorting to handle large datasets efficiently without requiring clients to fetch unnecessary information. An API's design should also consider whether it is "chatty" (requiring multiple calls for one operation) or "chunky," with the latter generally being favored to reduce network latency. - In the Indian context, the Active Pharmaceutical Ingredients (APIs) market, a significant portion of the country's pharmaceutical sector, is projected to grow from $18 billion in 2024 to $22 billion by 2030. While this refers to a different type of "API," the growth in technology-focused APIs is also significant, with the overall Indian API market projected to expand to $12 billion by 2035. - For founders building developer-focused products, thoughtful API versioning is crucial for managing changes and ensuring backward compatibility for existing integrations. Security is also a non-negotiable aspect, requiring robust authentication, authorization, rate limiting to prevent abuse, and careful input validation to protect against attacks.

Get your own daily briefing

Scout delivers personalized news, insights, and conversations tailored to your role and industry.

Download on the App Store

Shared from Scout - Be the smartest in the room.