REST's endpoint-per-resource model versus GraphQL's flexible query language
REST organizes data around resources with fixed endpoints: /users/123 returns all user fields, /posts/456 returns all post fields. Adding a new field means the endpoint delivers it to everyone. GraphQL flips this: clients send a single query specifying exactly which fields they need, and the server responds with that shape only.
REST forces clients to make multiple requests when data is spread across resources (fetching a user and their posts requires two calls). GraphQL resolves related data in one trip, reducing network round-trips and bandwidth waste.
Trade-offs in caching and complexity
REST's fixed endpoints are easy to cache with HTTP primitives: CDNs cache /users/123 responses directly. GraphQL queries are typically POST requests with bodies, making HTTP caching harder (though systems like persisted queries and automatic ID-based caching exist). REST is simpler to build for small APIs, while GraphQL pays off in complex, polyglot ecosystems where different clients need different data shapes.