This is an example of how to use the New Relic Data API (v2) to get your application's average error rate over a specific time period. This value appears as a percentage above the Error rate chart on your APM Summary page.
Important
While the examples utilize New Relic's REST API v2, we recommend using NRQL functions for executing metric timeslice queries. Each API value can be mapped to an equivalent NRQL function. To learn how to create NRQL queries based on these API examples, refer to our documentation.
To obtain the metric timeslice values, use the following three commands. This example uses the same time period for each command, and they are all summarized.
To obtain the error count:
bash
$
curl-X GET "https://api.newrelic.com/v2/applications/$APP_ID/metrics/data.xml"\