Skip to content

Commit

Permalink
add pagination tip
Browse files Browse the repository at this point in the history
  • Loading branch information
russbiggs committed Nov 20, 2024
1 parent da24a78 commit 9e6c63c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/content/docs/resources/measurements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ tableOfContents:

import FeedbackForm from '../../../components/FeedbackForm.astro';


import { Aside } from '@astrojs/starlight/components';

The measurements resources in the OpenAQ API provide measurement values from
Expand All @@ -24,8 +23,8 @@ API provides options for rolling up data into different aggregation periods.

`https://api.openaq.org/v3/sensors/{sensors_id}/measurements`

The `measurements` resource is the original measurement value as
reported by the upstream source.
The `measurements` resource is the original measurement value as reported by the
upstream source.

### Hours

Expand All @@ -43,8 +42,8 @@ The `hours` resource is the hourly average (mean) value of measurements.

`https://api.openaq.org/v3/sensors/{sensors_id}/days`

The `days` resource is the daily average (mean), computed from the hourly average
values from 01:00 to 0:00 in local time.
The `days` resource is the daily average (mean), computed from the hourly
average values from 01:00 to 0:00 in local time.

### Years

Expand Down Expand Up @@ -274,4 +273,4 @@ of 100.
}
```

<FeedbackForm />
<FeedbackForm />
10 changes: 10 additions & 0 deletions src/content/docs/using-the-api/pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description:
efficiently.
---
import FeedbackForm from '../../../components/FeedbackForm.astro';
import { Aside } from '@astrojs/starlight/components';



Expand All @@ -18,6 +19,15 @@ adjusted using the `limit` query parameter, up to a maximum of 1,000 results per
page, i.e., `limit=1000`. Using this limit in conjunction with the `page` query
parameter, you can access a large result set across multiple requests.

<Aside type="tip">
For resources with a high volume of results, such as `/measurements` and `/hours` using the
`datetimeFrom` and `datetimeTo` to limit to a single year or less is highly
recommended. Querying the entire dataset and paging using the `page` query
parameter alone can be slow. Adding a smaller time range allows the query to
leverage database indexes and will generally result in more performant
queries.
</Aside>

The total number of records in a result set is available in the JSON response
body in the `meta` object under the `found` key. The `meta` object in the
response JSON also provides the limit under the `limit` key:
Expand Down

0 comments on commit 9e6c63c

Please sign in to comment.