GraphQL
Beginner
1 min read
What is GraphQL?
Example
# GraphQL query — ask only for the fields you need
query GetUser {
user(id: "1") {
id
name
email
posts {
title
publishedAt
}
}
}
# Equivalent REST would require two calls:
# GET /users/1
# GET /users/1/posts
# GraphQL response mirrors the query shape:
# {
# "data": {
# "user": {
# "id": "1",
# "name": "Alice",
# "email": "alice@example.com",
# "posts": [
# { "title": "Hello World", "publishedAt": "2024-01-15" }
# ]
# }
# }
# }
# All requests go to one endpoint:
# POST https://api.example.com/graphql
Related Resources
GraphQL Reference
Complete tag & property list
GraphQL How-To Guides
Step-by-step practical guides
GraphQL Exercises
Practice what you've learned
More in GraphQL