How to retrieve records using pagination

In the previous post, we have seen how the subscription function works.
Now, we will retrieve records using pagination.

find function supports pagination. Here is a sample query to retrieve Message records.

{
  find(
    type: Message
    arcql: "*"
    first: 2
    after: "01G24H31FXVGB0JCBK181HRCP6"
    page: 4
  ) {
    edges {
      node {
        ... on Message {
          text
        }
      }
      cursor
    }
  }
}


  • first parameter indicates the number of records per page
  • after parameter is the hypi.id of the object after which the records need to be retrieved. Pagination starts after this object or record.
  • The total number of records gets divided by the number of records per page to determine the number of pages. If there are 10 records per page (first parameter) with a total of 100 records, the number of pages will be 10.
  • page parameter is the nth page number to be displayed from all the pages.
  • The pagination begins from the first record if we don’t provide an after parameter.