Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
GraphQL endpoints in Data API builder (DAB) let you query and modify data with precision. Each query declares exactly what fields you need and supports arguments for filtering, ordering, and paging results.
By default, DAB hosts its GraphQL endpoint at:
https://{base_url}/graphql
Entities exposed through configuration are automatically included in the GraphQL schema.
For example, if you have books and authors entities, both appear as root fields in the schema.
Note
Use any modern GraphQL client or IDE (like Apollo, Insomnia, or VS Code GraphQL) to explore the schema and autocomplete fields.
Keywords supported in Data API builder
| Concept | GraphQL | Purpose |
|---|---|---|
| Projection | items | Choose which fields to return |
| Filtering | filter | Restrict rows by condition |
| Sorting | orderBy | Define the sort order |
| Page size | first | Limit the items per page |
| Continuation | after | Continue from the last page |
Basic structure
Every GraphQL query starts with a root field that represents an entity.
{
books {
items {
id
title
price
}
}
}
The result is a JSON object with the same shape as your selection set:
{
"data": {
"books": {
"items": [
{ "id": 1, "title": "Dune", "price": 20 },
{ "id": 2, "title": "Foundation", "price": 18 }
]
}
}
}
Note
By default, DAB returns up to 100 items per query unless configured otherwise (runtime.pagination.default-page-size).
Query types
Each entity supports two standard root queries:
| Query | Description |
|---|---|
entity_by_pk |
Returns one record by its primary key |
entities |
Returns a list of records that match filters |
Example returning one record:
{
book_by_pk(id: 1010) {
title
year
}
}
Example returning many:
{
books {
items {
id
title
}
}
}
Filtering results
Use the filter argument to restrict which records are returned.
{
books(filter: { title: { contains: "Foundation" } }) {
items { id title }
}
}
This query returns all books whose title contains “Foundation.”
Filters can combine comparisons with logical operators:
{
authors(filter: {
or: [
{ first_name: { eq: "Isaac" } }
{ last_name: { eq: "Asimov" } }
]
}) {
items { first_name last_name }
}
}
See the filter argument reference for supported operators like eq, neq, lt, lte, and isNull.
Sorting results
The orderBy argument defines how records are sorted.
{
books(orderBy: { year: DESC, title: ASC }) {
items { id title year }
}
}
This returns books ordered by year descending, then by title.
See the orderBy argument reference for more details.
Limiting results
The first argument limits how many records are returned in a single request.
{
books(first: 5) {
items { id title }
}
}
This returns the first five books, ordered by primary key by default.
You can also use first: -1 to request the configured maximum page size.
Learn more in the first argument reference.
Continuing results
To fetch the next page, use the after argument with the cursor from the previous query.
{
books(first: 5, after: "eyJpZCI6NX0=") {
items { id title }
}
}
The after token marks where the prior page ended.
See after argument reference for more details.
Field selection (projection)
In GraphQL, you choose exactly which fields appear in the response.
There is no wildcard like SELECT *. Request only what you need.
{
books {
items { id title price }
}
}
You can also use aliases to rename fields in the response:
{
books {
items {
bookTitle: title
cost: price
}
}
}
See field projection reference for details.