Pagination
StreetLight Advanced Traffic Counts API
If a metrics
or geometry
query returns a large set of results, StreetLight automatically paginates the response. This typically occurs when the response includes more than 10,000 rows. The first page of results will be returned as part of the main response as well as the URL for the next
page in the paging
part of the response.
If our systems experience processing delays (>10 seconds), the initial response may return no data rows with a paging
offset of 0
and a response status
of pending
. This means the data isn't ready yet. Wait a few seconds and request the next
URL after a short delay to return results as normal.
Navigating Paginated Responses
If the response is sufficiently large, a metrics or geometry call includes a next URL that navigates to the next page of results. The structure of the page response will be similar to the main response.
It is possible to navigate to any in-range offset, including offset=0 to re-query the data. Log your paging URLs in case an error occurs during processing, in order to maximize the chances of being able to retrieve data without doing another query.
The last page of your results will not have a
next
paging URL orpaging
object.
Paging Endpoints
To retrieve a subset of results from a previous metrics
or geometry
query, use their corresponding paging endpoints:
Parameters
uuid
: The request_id
returned in the initial query response.
offset
: The row index from which to start returning results.
Example
If your metrics query returned 8,000 segments, the initial response includes rows 0–3,999. To fetch the remaining rows, the URL of the request would be:
"https://api.streetlightdata.com/satc/v1/metrics/paging/{request_id}?offset=4000"
Updated 2 days ago