GraphQL API

GraphQL API

Latest Poppulo platform GraphQL API

Sorting and Filtering

Sorting

Sorting is often used when a Query is returning a list of results to the client. Sorting ensures a consistent ordering of the data for the client.

An optional sortBy input type is used to specify the field to sort by and the direction of the sort.

  • field: (required) enum value
  • order: (optional) ASCENDING | DESCENDING - defaults to ASCENDING

Example Query

    # I want to sort by the group name in descending order
    query {
        exampleQuery(sortBy:{ field: groupName, order: DESCENDING }) {
            edges {
                node {
                    status
                    group {
                        name
                    }
                }
            }
        }
    }

Sorting is supported on a query by query basis. Please refer to the specific Query operation in the GraphQL API Reference for details.

Filtering

Filtering allows for reducing the set of results returned to a client by a Query - and is effectively a form of searching.

An optional filter input type is used to specify which field(s) to filter on and which filtering operations to apply.

  • field: (required) field name to filter on
  • operator: (required) filter operator to use
    • eq: short for equal, must match the given data exactly
    • in: short for in list, must be an element of the list
  • value: (required) value to use in the filter

Note: Specific filter fields and operators are documented on the relevant Query operations that support filtering.

    # I want all the values that have a status that equals REQUIRED
    query {
        exampleQuery(filter:{ status: { eq: REQUIRED }}) {
            edges {
                node {
                    status
                    group {
                        name
                    }
                }
            }
        }
    }

Filtering is supported on a query by query basis. Please refer to the specific Query operation in the GraphQL API Reference for details.

Next steps

Updates and Deprecation