---
title: Getting Apdex data for apps or browsers (v2)
source: https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/getting-apdex-data-apps-or-browsers-v2
---

Here are some examples of how to use the New Relic REST API (v2) to get [Apdex](https://docs.newrelic.com/docs/apm/new-relic-apm/apdex/apdex-measuring-user-satisfaction) data for your application and browser, for a specific [application ID](https://docs.newrelic.com/docs/apm/apis/requirements/identification-code) and [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key#viewing). By default, this will provide a list of values every minute for the [last 30 minutes](https://docs.newrelic.com/docs/apm/apis/api-v2-examples/specifying-time-range-v2) in JSON format.

> #### ⚠️ IMPORTANT
>
> While the examples utilize New Relic's REST API v2, we recommend using [NRQL functions](https://docs.newrelic.com/docs/nrql/get-started/introduction-nrql-new-relics-query-language/) 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](https://docs.newrelic.com/docs/apis/rest-api-v2/migrate-to-nrql/).

When acquiring data, the values returned may be affected by the time period you specify and the way the data is stored. For more information, see [Extracting metric data](https://docs.newrelic.com/docs/apis/extracting-metric-data).

## Metric names and values for Apdex [#apdex-names]

To specify Apdex metric names and values with REST API calls, use these codes as needed.

| **Metric name**                      | **Metric value** |
| ------------------------------------ | ---------------- |
| `Apdex`                              |                  |
| `score`: Application's Apdex score   |                  |
| `s`: Application's satisfied count   |                  |
| `t`: Application's tolerating count  |                  |
| `f`: Application's frustrated count  |                  |
| `count`: Application's request count |                  |
| `EndUserApdex`                       |                  |
| `score`: Browser's Apdex score       |                  |
| `s`: Browser's satisfied count       |                  |
| `t`: Browser's tolerating count      |                  |
| `f`: Browser's frustrated count      |                  |
| `count`: Browser's request count     |                  |

The calculation used to determine the `score` is explained in [Apdex: Measuring user satisfaction](https://docs.newrelic.com/docs/apm/new-relic-apm/apdex/apdex-measuring-user-satisfaction). The following sections describe how to obtain the `score` and the [s, t, and f values](#apdex-all) used to arrive at it.

## Average Apdex score [#apdex-average]

To obtain the [average](https://docs.newrelic.com/docs/apm/apis/requirements/calculating-average-metric-values-summarize) Apdex `score` (both app and browser) for a [specific time period](https://docs.newrelic.com/docs/apm/apis/api-v2-examples/specifying-time-range-v2), use this command. This example shows 24 hours in XML format for your [application ID](https://docs.newrelic.com/docs/apm/apis/requirements/identification-code) and its corresponding [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key#viewing).

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \
     -H "X-Api-Key:${API_KEY}" -i \
     -d 'names[]=Apdex&names[]=EndUser/Apdex&values[]=score&from=2014-01-01T00:00:00+00:00&to=2014-01-02T00:00:00+00:00&summarize=true'
```

This will return the same Apdex scores shown in your [APM **Overview** page](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/applications-overview-dashboard).

## Average Apdex metric values [#apdex-metrics]

To obtain the [average](https://docs.newrelic.com/docs/apm/apis/requirements/calculating-average-metric-values-summarize) Apdex [metric values](https://docs.newrelic.com/docs/apm/apis/requirements/extracting-metric-data) for a [specific time range](https://docs.newrelic.com/docs/apm/apis/api-v2-examples/specifying-time-range-api-v2), use this command. This example shows 12 hours in XML format for your [application ID](https://docs.newrelic.com/docs/apm/apis/requirements/identification-code) and its corresponding [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key#viewing).

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \
     -H "X-Api-Key:${API_KEY}" -i \
     -d 'names[]=Apdex&names[]=EndUser/Apdex&values[]=score&from=2014-06-09T00:00:00+00:00&to=2014-06-09T12:00:00+00:00&summarize=true'
```

**Tip:** To return a series of Apdex scores instead of an average, omit `&summarize=true`.

## All average Apdex values [#apdex-all]

To obtain the complete set of [average](https://docs.newrelic.com/docs/apm/apis/requirements/calculating-average-metric-values-summarize) scores, `s`, `t`, `f`, `count`, and threshold values for a [specific time range](https://docs.newrelic.com/docs/apm/apis/api-v2-examples/specifying-time-range-api-v2), use this command. This example shows 24 hours ([adjusted to the time zone](https://docs.newrelic.com/docs/apm/apis/requirements/specifying-time-range-api-v2#utc) 6 hours west of UTC by using `%2B06:00`) in XML format for your [application ID](https://docs.newrelic.com/docs/apm/apis/requirements/identification-code) and its corresponding [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/rest-api-key#viewing).

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \
     -H "X-Api-Key:${API_KEY}" -i \
     -d 'names[]=Apdex&names[]=EndUser/Apdex&from=2014-06-09T00:00:00%2B06:00&to=2014-06-10T00:00:00%2B06:00&summarize=true'
```

> #### 💡 TIP
>
> Even though this example adjusts the time zone, the output still returns as UTC time.
