Field Selection
One reason teams reach for GraphQL is over-fetching: an endpoint returns 30 fields when the client needs 3. REST can offer the same control with two simple query parameters.
Sparse fieldsets
Section titled “Sparse fieldsets”Let the client list the fields it wants with ?fields=:
GET /articles?fields=id,titleThe server returns only those keys. This shrinks payloads for mobile clients and list views, and documents intent. Always include the resource’s identifier even if not requested, so responses stay addressable.
Expanding related resources
Section titled “Expanding related resources”By default, link to related resources rather than embedding them. When a client wants them inline, let it opt in with ?expand=:
GET /articles/42?expand=authorWithout expand, author is a reference ({ "id": 7, "href": "/users/7" }); with it, the author object is embedded. This keeps the default response small while avoiding an extra round trip when the client genuinely needs the related data.