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

Specify a time range (v2)

You can specify a time range for the data to be returned in a New Relic REST API call. You can also request to return an average over the time range instead of the series of values returned by default.

Change the default 30 minute time range

The default time range for an API call is the last 30 minutes. To modify the time range, include from= and optional to= values. (To end the time range at the current time, omit to=.)

Tip

Data availability is subject to the data retention policy for your subscription level.

Example:

curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \ -H "Api-Key:$API_KEY" -i \ -d 'names[]=Agent/MetricsReported/count&from=2014-08-11T14:42:00+00:00&to=2014-08-11T15:12:00+00:00'

The time period returned for each data point depends on the time range you specify. To modify the time period, include the period parameter in your query.

If you are using the New Relic REST API Explorer (v2), you can use the diamond icon to select time ranges. If you have an EU region account, the above URL begins with https://api.eu.newrelic.com.

Offset UTC

By default the API time input uses Universal Time Coordinated (UTC). To offset the UTC, use plus or minus 00:00 in your API call. This allows you to input times in a different time zone; however, this does not modify the output times, which are always UTC.

  • For time zones east of UTC, use a minus sign (-). This symbol has no special meaning in HTTP or HTTPS requests.
  • For time zones west of UTC, use the encoded value %2B to indicate a plus sign (+).
  • If you have an EU region account, the following URLs begin with https://api.eu.newrelic.com.
Copyright © 2024 New Relic Inc.

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