📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials API Design GraphQL

GraphQL

5 min read Quiz at the end
GraphQL gives clients control over response shape — one endpoint, no over-fetching or under-fetching.

GraphQL

Client specifies exact fields needed — eliminates over-fetching and under-fetching.

# Query
query {
  user(id: 1) {
    name
    email
    posts(limit: 5) { title created_at }
  }
}

# Mutation
mutation {
  createPost(input: {title: "Docker", body: "..."}) {
    id title created_at
  }
}

# Schema (SDL)
type User {
  id:    ID!
  name:  String!
  posts: [Post!]!
}
type Query {
  user(id: ID!): User
  posts(limit: Int): [Post!]!
}

# Single endpoint: POST /graphql
Topic Quiz · 1 questions

Test your understanding before moving on

1. What is the main advantage of GraphQL over REST?
💡 GraphQL lets clients specify the exact shape of the response — no more over-fetching unused fields.