The New Relic REST API (v2) paginates some responses, for performance reasons. This is because returning the entire data set might be feasible for some queries but prohibitive for others that return a very large amount of data.
Requirements and limitations
- Metric data return:
- Pagination is no longer available for metrics output for some customers (deprecation beginning December 2020).
- Returns up to 3000 results per cell. For large outputs, we recommend narrowing the query using application ID or another attribute.
- The sort order for returned data is indeterminate. Do not assume or rely on a particular order.
The data returned per page depends on what data is requested. The number of pages depends on the number of JSON objects necessary to complete the list.
Before listing metric names, see Metric name listing guidelines.
Request a specific page
To specify a page, add the
page= parameter to the query. Here's an example:
In the REST API Explorer, you can quickly change the page being viewed.
Link header examples showing page count
The API call returns the
Link header if the data is paginated. This indicates the number of pages and the page being viewed. This line also appears at the top of the
Response in the REST API Explorer.
The Link header will only appear if the output data is paginated.
rel="last" reference will not be shown when making calls to the Violations endpoint (
https://api.newrelic.com/v2/alerts_violations.json). To determine the final page when making calls to this endpoint, look for the absence of a
To obtain this line using some implementations of
curl, you may need to include the
New Relic uses the RFC 5988 standard format for links.