Pagination

When endpoints might return a large amount of data, the API will return only a subset of that data by returning a Pagination object.

A Pagination object includes the total count of objects available across all pages, the data available on this page, and a paging block which contains instructions for accessing the next/previous pages.

Auto-Pagination

Automated pagination is available in the latest version of the Python and Java libraries. Here’s an example:

# Prints all observations, one-by-one, by iterating through
# all the required API requests
for observation in conn.experiments(EXPERIMENT_ID).observations().fetch().iterate_pages():
  print(observation)

# Since iterate_pages() returns an iterator, you may need to turn it into a
# list if you want to do more complicated logic
obs_list = list(conn.experiments(EXPERIMENT_ID).observations().fetch().iterate_pages())

Last updated