APIs define how components communicate. REST, GraphQL, and gRPC each make different trade-offs around flexibility, performance, and complexity — knowing when to use each is a core system design skill.
REST (Representational State Transfer) is the dominant API paradigm for web services. It uses standard HTTP methods and treats everything as a resource.
| Verb | Operation | Idempotent? | |---|---|---| | GET | Read a resource | Yes | | POST | Create a resource | No | | PUT | Replace a resource | Yes | | PATCH | Partial update | No | | DELETE | Remove a resource | Yes |
GET /users # List users
GET /users/123 # Get user 123
POST /users # Create a new user
PUT /users/123 # Replace user 123
PATCH /users/123 # Update fields of user 123
DELETE /users/123 # Delete user 123
GET /users/123/posts # Get posts for user 123
GraphQL lets clients request exactly the data they need — nothing more, nothing less.
query {
user(id: "123") {
name
email
posts(last: 5) {
title
createdAt
}
}
}
Pros:
Cons:
Best for: APIs consumed by multiple clients with different data needs (iOS, Android, web)
gRPC is a high-performance RPC framework using Protocol Buffers (binary serialization) over HTTP/2.
Pros:
Cons:
Best for: Internal microservice-to-microservice communication
| Feature | REST | GraphQL | gRPC | |---|---|---|---| | Format | JSON | JSON | Binary (Protobuf) | | Performance | Good | Good | Excellent | | Caching | Easy (HTTP) | Hard | Hard | | Type safety | No (unless OpenAPI) | Yes | Yes | | Browser support | Native | Native | Limited | | Learning curve | Low | Medium | High | | Best for | Public APIs | Complex client needs | Internal services |
Never break existing clients. Common versioning strategies:
/api/v1/users (simple, explicit)Accept: application/vnd.api+json;version=1