Explanation
GraphQL basics
How GraphQL works and why the Loco API uses it.
GraphQL lets you ask for exactly the data you need, in one request, from one endpoint.
Queries read, mutations write
You choose the shape
The response mirrors your query. If you only select id, you only get id:
query { me { id } }Types
Every field has a type. A trailing ! means the value is never null, and [T] means a list of T. Click any type in the reference to see its fields.
Variables
Pass dynamic values as variables rather than string-building queries:
query Restaurant($id: ID!) {
restaurant(id: $id) { id }
}{ "id": "…" }