The schema is at the heart of a GraphQL API. It is a typed declaration of the relationship among the data exposed through the API. In this lesson, we dive deep into how to write GraphQL schemas — and build the schema for the Planetary Party Planner API.
GraphQL has its own Schema Definition Language (SDL) — a human-readable syntax used to define the structure, types, and relationships in a GraphQL schema. It's a language-agnostic way to represent the schema, which can be understood and implemented by various GraphQL libraries across different programming languages.
It all starts at the root: Queries and Mutations
Any API serves two key purposes: getting and modifying data. A GraphQL schema — designed as a data graph — starts at the root: getting data with queries and modifying data with mutations.
We define the set of queries in a GraphQL schema with a type definition of Query
.
Let's learn all about GraphQL queries (and SDL!) with the queries we need in the Planetary Party Planner API.