• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Pagination for API output

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.

Important

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:

curl -X GET 'https://api.newrelic.com/v2/alerts_incidents.json?page=3' \
     -H "Api-Key:$API_KEY" -i

In the REST API Explorer, you can quickly change the page being viewed.

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.

Important

The Link header will only appear if the output data is paginated.

Tip

The 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 rel="next" reference.

To obtain this line using some implementations of curl, you may need to include the -v option.

curl -v -X GET 'https://api.newrelic.com/v2/applications/$APP_ID/...'

New Relic uses the RFC 5988 standard format for links.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.