---
title: List your app ID and metric timeslice data (v2)
source: https://docs.newrelic.com/docs/apis/rest-api-v2/application-examples-v2/list-your-app-id-metric-timeslice-data-v2
---

Here are examples of how to use the New Relic REST API (v2) to get metric names and [average](https://docs.newrelic.com/docs/apm/apis/requirements/calculating-average-metric-values-summarize) values 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). The examples also show different [time ranges](https://docs.newrelic.com/docs/apm/apis/api-v2-examples/specifying-time-range-v2).

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 timeslice data](https://docs.newrelic.com/docs/apis/extracting-metric-data).

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

## List all application IDs [#view_all_app_id]

You can also use New Relic's REST [API Explorer](https://docs.newrelic.com/docs/apm/apis/api-explorer-v2/parts-api-explorer) to get the same [metric timeslice data for your app](https://docs.newrelic.com/docs/apm/apis/api-v2-examples/metric-data-examples-api-v2) information as this example.

To view all of your apps' IDs, use the following command.

```bash
curl -X GET 'https://api.newrelic.com/v2/applications.json' \
     -H "Api-Key:$API_KEY" -i
```

-   Replace `$API_KEY` with your [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/getting-started/introduction-new-relic-rest-api-v2#api_key).

The output will be an array of data where the element is an application and the data associated with it. For example, here are the first two elements for app ID 96785 ("GreatTimes Staging") and 1622 ("GreatTimes Prod"):

```json
{
  "applications": [
    {
      "id": 96785,
      "name": "GreatTimes Staging",
      "language": "ruby",
      "health_status": "gray",
      ...
    },
    {
      "id": 1622,
      "name": "GreatTimes Prod",
      "language": "ruby",
      "health_status": "green",
      ...
    }
  ]
}
```

## List app ID by name [#view_single_app_id]

To view a specific app's ID if you know the name, substitute the name for `$NAME` and `$API_KEY` with your [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/getting-started/introduction-new-relic-rest-api-v2#api_key) in the following command:

```bash
curl -X GET 'https://api.newrelic.com/v2/applications.json' \
     -H "Api-Key:$API_KEY" -i \
     -d "filter[name]=$NAME"
```

The output will be the same as shown in the [list all app IDs example](#view_all_app_id) but only for the specific application.

## Metric name listing guidelines [#name_list_guidelines]

Listing the available metric names for your application can be a very intensive operation and should only be used as necessary. Listing a large number of metric names may have a detrimental effect on your responsiveness, as well as that of other uses and may lead to invoking [overload protection](https://docs.newrelic.com/docs/apis/rest-api-v2/requirements/api-overload-protection-handling-429-errors).

Follow these guidelines to optimize your use:

| Listing metric names | Guidelines                                                                                                                                                                                                                                                                                      |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Metric names         | Carefully consider the metric names you need. If you know any part of the metric name, use the `name=` filter to limit the amount of data returned. This filter is a simple character match (no regular expression is available), but it can significantly reduce the amount of data retrieved. |
| Cache                | Once you get your metric names, consider caching this list for future use. In most cases the metric names are not volatile and can be reused, saving processing time.                                                                                                                           |

## List metric names for your app [#view_app_metrics_names]

To view the metric names available for your application:

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics.json" \
     -H "Api-Key:$API_KEY" -i
```

-   Replace `$API_KEY` with your [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/getting-started/introduction-new-relic-rest-api-v2#api_key).

The output will be similar to the following. This shows two of the many metric names available and their values. These lists may be long. Please consider the [guidelines](#name_list_guidelines) for listing your metric names.

```json
{
  "metrics": [
    {
      "name": "ActiveRecord/Account/create",
      "values": [
        "average_response_time",
        "calls_per_minute",
        "call_count",
        "min_response_time",
        "max_response_time",
        "average_exclusive_time",
        "average_value",
        "requests_per_minute",
        "standard_deviation"
      ]
    },
    ...
    {
      "name": "Apdex/members/destroy",
      "values": [
        "s",
        "t",
        "f",
        "count",
        "score",
        "value",
        "threshold",
        "threshold_min"
      ]
    },
    ...
  ]
}
```

Filter your metric name output, to return a smaller list, by specifying the `name=` filter like this:

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics.json" \
     -H "Api-Key:$API_KEY" -i \
     -d "name=Controller/welcome/index"
```

-   Replace `$API_KEY` with your [API key](https://docs.newrelic.com/docs/apis/rest-api-v2/getting-started/introduction-new-relic-rest-api-v2#api_key).

## Get your app's metric timeslice data values [#app_metric_data_values]

To view the metric timeslice data for your application:

```bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
     -H "Api-Key:$API_KEY" -i \
     -d 'names[]=EndUser&values[]=call_count&values[]=average_response_time&summarize=true'
```

**One metric name, multiple values**

You can get multiple values from the same metric name in a single call, as shown in this example.

````json
{
  "metric_data": {
    "from": "2014-05-20T23:41:15+00:00",
    "to": "2014-05-21T00:11:15+00:00",
    "metrics": [
      {
        "name": "EndUser",
        "timeslices": [
          {
            "from": "2014-05-20T23:39:00+00:00",
            "to": "2014-05-21T00:08:59+00:00",
            "values": {
              "call_count": 724,
              "average_response_time": 2110
            }
          }
        ]
      }
    ]
  }
}
```

````

**Multiple metric names, individual values**

If you request values from multiple metrics that don't share all requested value fields, you can only get the values from one metric name at a time.

For example, if you change the command so it contains two metric names (using two `"names[]="` conditions and corresponding `"values[]="` conditions), only the associated values for the first metric name (`EndUser`) will be returned.

````bash
curl -X GET "https://api.newrelic.com/v2/applications/${APP_ID}/metrics/data.json" \
     -H "Api-Key:$API_KEY" -i \
     -d "names[]=EndUser&names[]=EndUser/Apdex&values[]=call_count&values[]=average_response_time&values[]=score&summarize=true"
```

The `EndUser` name in this example has `call_count` and `average_response_time` values associated with it, but not `score.`

```json
{
  "metric_data": {
    "from": "2014-05-20T23:41:15+00:00",
    "to": "2014-05-21T00:11:15+00:00",
    "metrics": [
      {
        "name": "EndUser",
        "timeslices": [
          {
            "from": "2014-05-20T23:39:00+00:00",
            "to": "2014-05-21T00:08:59+00:00",
            "values": {
              "call_count": 724,
              "average_response_time": 2110
            }
          }
        ]
      },
      {
        "name": "EndUser/Apdex",
        "timeslices": [
          {
            "from": "2015-03-31T20:33:00+00:00",
            "to": "2015-03-31T21:02:59+00:00",
            "values": {}
          }
        ]
      }
    ]
  }
}
```

````
