---
title: Average response time examples (v2)
source: https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/average-response-time-examples-v2
---

Here is an example of how to use the New Relic API Explorer (v2) to get your application's average response time over a specified time period.

> #### ⚠️ 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/).

## Average response time [#average_response]

The average response time (milliseconds) is the value that appears on the main chart for your app on the [APM **Summary** page](https://docs.newrelic.com/docs/applications-menu/applications-overview). New Relic uses this formula to calculate response time:

```
Response time = HttpDispatcher:average_call_time + ((WebFrontend/Queue:call_count * WebFrontend/Queue:average_response_time) / HttpDispatcher:call_count)
```

To obtain the metric values, use the following two commands.

In these examples, the same time period has been used for each, and they are both summarized (averaged).

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \
     -H "X-Api-Key:${API_KEY}" -i \
     -d 'names[]=HttpDispatcher&values[]=average_call_time&values[]=call_count&from=2014-03-01T20:59:00+00:00&to=2014-03-01T21:59:00+00:00&summarize=true'
```

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.xml" \
     -H "X-Api-Key:${API_KEY}" -i \
     -d 'names[]=WebFrontend/QueueTime&values[]=call_count&values[]=average_response_time&from=2014-03-01T20:59:00+00:00&to=2014-03-01T21:59:00+00:00&summarize=true'
```

Your application may have zero queuing time for the time period in question. In that case, the `WebFrontend/QueueTime` metric will have a zero value.

> #### 💡 TIP
>
> If your app has **never** reported a queuing time, the metric `WebFrontend/QueueTime` will not exist.

## Response time [#app_rep_time]

On the [APM **Summary** page](https://docs.newrelic.com/docs/applications-menu/applications-overview), [Response time](https://docs.newrelic.com/docs/data-analysis/user-interface-functions/view-your-data/response-time) is the overlaid line within the main chart for your app. To obtain the metric values shown by this line, use the same formula and two commands described above, but remove `summarize=true` from the commands.
