Backend API Design - herougo/SoftwareEngineerKnowledgeRepository GitHub Wiki
Why use REST over RPC?
- source: ChatGPT (verified with research unless specified)
Reasons I fully understand
-
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 usersPOST /users→ create a new userDELETE /users/123→ delete user 123
- RPC, on the other hand, often uses POST for everything, making it harder to reason about or cache.
- REST is designed around standard HTTP methods like GET, POST, PUT, DELETE, etc., which naturally map to CRUD operations:
-
Improved Readability and Predictability:
- REST URLs are resource-oriented, making them intuitive.
- e.g.
/orders/123/itemsis more descriptive than something like POST/getOrderItems.
-
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
-
Better caching support
-
Broad support for REST (e.g. Postman, etc)
-
Loose coupling between client and server
-
Standard conventions (e.g. plural vs singular, etc)