GraphQL queries¶
Querying content¶
You can query a single Content item or a list of Content items using fields defined in the domain schema.
Get a Content item¶
To get a specific Content item by its ID, use its relevant singular field,
for example article
, folder
, image
, etc.:
1 2 3 4 5 6 7 8 9 10 |
|
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
You can request any Fields of the Content item. In the example above, these are title
and author
.
Get a group of Content items¶
To get a list of all Content items of a selected type, use the plural field, e.g. articles
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
Edges
edges
are used when querying plural fields to offer pagination.
Get Content Type information¶
To get the IDs and names of all Fields in the article
Content Type:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
Filtering¶
To get all articles with a specific text:
1 2 3 4 5 6 7 8 9 10 11 |
|
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Sorting¶
You can sort query results using sortBy
:
1 2 3 4 5 6 7 8 9 10 11 |
|
Pagination¶
GraphQL offers cursor-based pagination for paginating query results.
You can paginate plural fields using edges
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
This query returns the first three articles, ordered by their publication date.
If the current Connection
(list of results) is not finished yet and there are more items to read,
hasNextPage
will be true
.