Skip to main content

Filters and pagination 📃

All queries that return a list of resources are paginated and have the same format. You can use the filters argument to specify what resources you want to fetch.

Query:​

{
"filters": {
"limit": 1,
"sort": "ASCENDING",
"keywords": "Jane",
"filters": {
"metadata.myCustomerSource": "crm"
},
"cursor": "01arz3ndektsv4rrffq69g5fav"
}
}
query ($filters: FilterInput) {
customers(filters: $filters) {
count
total
cursor
items {
...
}
}
}

Response:​

{
"customers": {
"count": 1,
"total": 12,
"cursor": "014r9g5fasvavrzrffq6ndekt3",
"items": [
...
]
}
}

Response fields:​

  • count: The number of items returned in the current page.
  • total: The total number of items that match the query.
  • cursor: A string that points to the next page of results. You can use it to fetch the next page of results. If there are not more results, the cursor field will be null.
  • items: The list of items returned in the current page.

Cursor-based pagination​

You can navigate the results using the cursor field. The cursor field is a string that points to the next page of results. You can use it to fetch the next page of results. If there are not more results, the cursor field will be null.

The query has the following format:

query ($filters: FilterInput) {
customers(filters: $filters) {
count
total
cursor
items {
...
}
}
}

The cursor field is a string that points to the next page of results. You can use it to fetch the next page of results.

Filters​

You can filter results by one or more fields using the filters argument. Each entity has a different set of filters you can use.

Eg.

{
"filters": {
"filters": {
"name": "Jane",
"metadata.myCustomerSource": "crm"
}
}
}

Sorting​

You can sort the results by creation date (either DESCENDING or ASCENDING). The default sort order is DESCENDING.

{
"filters": {
"sort": "ASCENDING"
}
}

Limit​

You can limit the number of results returned by the query. The default limit is 50.

{
"filters": {
"limit": 5
}
}