Skip to content

Commit 9e6c63c

Browse files
committed
add pagination tip
1 parent da24a78 commit 9e6c63c

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/content/docs/resources/measurements.mdx

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ tableOfContents:
66

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

9-
109
import { Aside } from '@astrojs/starlight/components';
1110

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

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

27-
The `measurements` resource is the original measurement value as
28-
reported by the upstream source.
26+
The `measurements` resource is the original measurement value as reported by the
27+
upstream source.
2928

3029
### Hours
3130

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

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

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

4948
### Years
5049

@@ -274,4 +273,4 @@ of 100.
274273
}
275274
```
276275

277-
<FeedbackForm />
276+
<FeedbackForm />

src/content/docs/using-the-api/pagination.mdx

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ description:
88
efficiently.
99
---
1010
import FeedbackForm from '../../../components/FeedbackForm.astro';
11+
import { Aside } from '@astrojs/starlight/components';
1112

1213

1314

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

22+
<Aside type="tip">
23+
For resources with a high volume of results, such as `/measurements` and `/hours` using the
24+
`datetimeFrom` and `datetimeTo` to limit to a single year or less is highly
25+
recommended. Querying the entire dataset and paging using the `page` query
26+
parameter alone can be slow. Adding a smaller time range allows the query to
27+
leverage database indexes and will generally result in more performant
28+
queries.
29+
</Aside>
30+
2131
The total number of records in a result set is available in the JSON response
2232
body in the `meta` object under the `found` key. The `meta` object in the
2333
response JSON also provides the limit under the `limit` key:

0 commit comments

Comments
 (0)