⬡ GraphQL Beginner

What is a GraphQL query?

Answer

A GraphQL query is a read operation used to fetch data from the server. It mirrors the shape of the data you want back. For example: query { user(id: "1") { name email posts { title } } } fetches the user's name, email, and their posts' titles in one round trip. The server returns a JSON object with a data key whose structure exactly matches the query. Queries are sent as HTTP POST requests (or GET with URL-encoded query) to the single GraphQL endpoint.