Backend API Design - herougo/SoftwareEngineerKnowledgeRepository GitHub Wiki

Why use REST over RPC?

  • source: ChatGPT (verified with research unless specified)

Reasons I fully understand

  1. Better Use of HTTP Semantics

    • REST is designed around standard HTTP methods like GET, POST, PUT, DELETE, etc., which naturally map to CRUD operations:
      • GET /users → retrieve users
      • POST /users → create a new user
      • DELETE /users/123 → delete user 123
    • RPC, on the other hand, often uses POST for everything, making it harder to reason about or cache.
  2. Improved Readability and Predictability:

    • REST URLs are resource-oriented, making them intuitive.
    • e.g. /orders/123/items is more descriptive than something like POST /getOrderItems.
  3. Stateless:

    • REST enforces stateless communication — every request contains all the information needed. This leads to better scalability and makes load balancing easier.
    • RPC can sometimes encourage server-side state, which can be problematic in distributed systems.

Other Reasons I have not verified

  1. Better caching support

  2. Broad support for REST (e.g. Postman, etc)

  3. Loose coupling between client and server

  4. Standard conventions (e.g. plural vs singular, etc)