Documentation Center

Basic GraphQL query structure

In its basic form, a GraphQL query consists of a filter, optionally a sort expression, and a list of fields to return.

The structure of an items() call is as follows:
{
  items(
    filter {
      FILTEREXPRESSION
    }
  ) {
      RETURNEDFIELDS
}
If you want, you can add an expression to sort the results:
{
  items(
    filter {
      FILTEREXPRESSION
    },
    sort: {
      SORTEXPRESSION
    }

  ) {
      RETURNEDFIELDS
}

In either of these calls, FILTEREXPRESSION can be a simple or complex expression, specifying which filters to apply to the query.

When querying Component Presentations, you can replace items() with componentPresentations() in each query.