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 requestsfor 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 logicobs_list =list(conn.experiments(EXPERIMENT_ID).observations().fetch().iterate_pages())
importcom.sigopt.model.*;importcom.sigopt.*;Sigopt.clientToken="CLIENT_TOKEN";// Prints all experiments, one-by-one, by iterating through// all the required API requests.Pagination<Observation> p =newExperiment(EXPERIMENT_ID).observations().list().call();// p.iteratePages() returns an Iterable<Experiment>for (Observation o:p.iteratePages()) {System.out.println(o.getId());}