Pagination
The OpenAQ platform holds vast amounts of data. Because of this, the API returns data in smaller subsets. Pagination helps you fetch large datasets across multiple requests.
Page and limit
Section titled “Page and limit”The OpenAQ Python SDK supports page and limit arguments for all resources
that use a list() method.
page- the page number to retrieve. Defaults to1. Must exceed zero.limit- the number of results per page. Defaults to100. Must range from1to1000.
Examples
Section titled “Examples”To retrieve the first 50 results:
locations = client.locations.list(page=1, limit=50)To retrieve the next 50 results, increment page:
locations = client.locations.list(page=2, limit=50)The meta object
Section titled “The meta object”Every response includes a meta object with metadata. The meta.found field
shows the total number of matching records. Use this value to calculate the
total page count.
If meta.found returns ‘>1000’, you cannot calculate the exact page count in
advance. Narrow your query using filters like countries_id or parameters_id
to reduce the dataset size. See the meta object reference for all available
fields.
The Paging Results page provides examples on how to
use the meta object and pagination logic.