New Relic stores SLA data forever for eligible accounts, so you can use the New Relic REST API to generate service level agreement reports over any time period. For example, you can create SLA reports going back more than 12 days, weeks, or months.
You are not limited to standard day, week, or month time ranges. For example, you can extract metric data for a "holiday weekend" from 12/23 to 12/26 or "the 20 minutes after our site had problems" or whatever other period interests you.
UTC XML time format
You must specify the time in UTC XML format, so be sure to adjust for your time zone compared to UTC. For example, New Relic starts at 16:00:00 on the day before the selected data, since New Relic headquarters are in UTC-8.
When requesting metrics to use with summary reports, include the query string parameter summarize=true (v2) or summary=1 (v1) as shown in the examples.
Your report has some statistics that are scaled in the SLA reports in New Relic's user interface. New Relic changes the scale of page views in your report to show small numbers. Depending on your traffic, typically it might be displayed in thousands, millions, or billions.
Recommendation: To avoid a string of zeroes, divide this number appropriately for your own purposes.
End user statistics
End user statistics will reflect only the calls in which the agent gathered browser data. For example, end user stats may not appear in situations such as:
Transactions not in one of those categories, in case the page load did not complete for any reason
This is why there are fewer (sometimes many fewer) page views in the End User (browser) data section than in the App server data section.
The following sections contain code examples to acquire the data for values described above for the Daily (24hr) SLA statistics in the default GMT/UTC time zone. Adjust the from= and to= for your time range as desired.
There are syntactical differences between New Relic's REST API v2 and v1. The examples show how to use each.
REST API v2 commands
To obtain the browser (EndUser/RUM) load time and page view count for v2, from the command line, type:
curl-X GET "https://api.newrelic.com/v2/applications/$APP_ID/metrics/data.xml"\