Menu

1 / 3

GraphQL vs REST: over-fetching and asking for fields

DEV Community: graphql·System Design Simple·12 days ago
#JJDw9s1d
#devtographql#devto#dev#over#lab
Long article (1725 words) — no AI summary yet.
Reading 0:00
15s threshold

In GraphQL vs REST, over-fetching is a common point of comparison: a fixed REST response can send whole posts, bodies included, to a profile card that shows one name and three titles. GraphQL lets clients select fields and returns them in the same shape; REST responses can also be trimmed when the API supports it.

What over-fetching costs one card {#over-fetching}

Take a profile card showing four values: your friend's name and the titles of their three newest posts. A classic REST design serves it with two fixed resources, GET /users/42 and GET /users/42/posts , and each returns whatever fields the server put in that resource. (Part 48 covered how REST lays out addresses and verbs .) The client parses everything and keeps four values, which is over-fetching.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.