Pagination

Every search API response contains a pagination section to help facilitate paging through the results. Example:

"pagination": {
    "pages": 100,
    "page": 1,
    "next": {
        "offset": 10,
        "limit": 10
    }

Using the offset and limit fields in the next object, you can execute a second request to get the next page of results by adding &offset=10&limit=10 to your query (or by setting the limit and offset properties if you're using an SDK). The offset parameter is the number of results to skip and the limit parameter is the number of results to return.

To request results from a specific page, you can multiply the offset by the desired page number minus 1 to get the correct offset value. For example, if you are limiting searches to 10 objects per page, you can jump to the 10th page of results by multiplying the offset by 9: &limit=10&offset=90.

The pages field in the pagination object is the total number of pages available.

FAQs

How do I know when I've reached the end of the results?

There will be no next field in the pagination response.

	"pagination": {
		"pages": 25,
		"page": 25
	}

What happens if I page beyond the total number of results?

An empty result set is returned.

{
	"results": []
}

How can I get the exact number of results returned?

The pages value is an estimate of the number of pages. As of now, we don't support returning the exact number of results in the search API. We have it on the roadmap to support more specific counts for the number of results.

It is possible that when you query for the last page of results, the value of pages will increase, indicating that there are more pages available.

We recommend folks use either:

  1. Infinite scroll, or
  2. Dynamic page counts, that don't show the true "end" of pages

For example, when Google shows page numbers, they are "dynamic" in the sense that they change based on how deeply you page into the results:

Objective inc architectureObjective inc architecture

Was this page helpful?