You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs). info

**API Platform Base Path:**
`https://api.enterprise.apigee.com/v1/o/{org_name}`
**API Resource Path:** `/environments/{env_name}/stats/{dimension_name}`

**Description:** Use the GET method to retrieve metrics for a dimension

|---|---|
| **Verb:** | GET |
| **Auth:** | Basic Auth |
| **Media types:** | application/json |

**Overview:** A report is generated using a GET request on the `/stats` API resource, accompanied by:

- An optional URI parameter that defines the dimension for the report. Apigee defines a set of dimensions a pre-aggregates a set of metrics against those dimensions. If no dimension is defined (i.e., if the URI parameter is empty), then a report is generated for all APIs present in the environment specified.
- A set of query parameters that define the metrics, time range, time interval, and filter/drill-down aspects of the report.

`dimension_name`: A URI parameter that defines the entity for which the API
Platform metrics should be retrieved. Apigee defines a set of dimensions that can be used in
reports. Supported dimensions include:

- `/stats/apis`: API proxies in an organization on the API Platform
- `/stats/apiproducts`: API products defined in an organization
- `/stats/apps`: The name of the developer app making the request to your API
- `/stats/client_ip`: IP addresses of apps making the request to APIs on the API Platform
- `/stats/developer_email`: The email address of a developer registered in an organization on the API Platform
- `/stats/developer_app`: The name of the developer app making the request to your API
- `/stats/devs`:The unique Edge-generated developer ID registered in an organization on the API Platform
- `/stats/access_token`: The app end user's OAuth access token

**Filtering**

Filters can be applied to custom resources. Custom resources are:

| Symbol | Operation |
|---|---|
| `in` | for list inclusion |
| `notin` | for list exclusion |
| `eq` | = |
| `ne` | != or |
| `gt` | \> |
| `lt` |   |
| `ge` | \>= |
| `le` |   |

**Sample filters**

> [!NOTE]
> **Note:** You must put filter text between single quotes, for example, `'api1'`. Do *not* use double quotes.

| Description | Filter query structure |
|---|---|
| Stats for API proxies named either api1 or api2 | `filter=(apiproxy in 'api1','api2')` |
| Stats for all API proxies except api1 and api2 | `filter=(apiproxy notin 'ap1','api2')` |
| Stats where there are no errors | `filter=(iserror eq 0)` |
| Stats where there is no error messages or the API proxy name is api1 or api2 | `filter=(iserror eq 1) or (apiproxy in 'api1','api2')` |
| Stats where (response code is either 201 or 301) and (there are errors) or (API proxy name is either api1 or api2) | `filter=(responsecode le 201 or responsecode eq 301) and (iserror eq 1) or (apiproxy in 'api1','api2')` |

**Sample Request:**

```
$ curl -X GET -H "Accept:application/json" \
https://api.enterprise.apigee.com/v1/o/{org_name}/environments/{env_name}/stats/{dimension_name}?"select={metric_name}&timeRange=1/1/2013%2000:00~1/2/2013%2000:00&timeUnit=hour&sortby={metric_name}&sort=DESC&filter=(apiproxy%20in%20'weather','news')" \
-u myname:mypass
```
**Query Parameters:**

| Name | Description | Default | Required? |
|---|---|---|---|
| select | Designates the metric to be aggregated for the report. Supported metrics are message_count, error_count, total_response_time, max_response_time, min_response_time, data_exchange_size, end_point_response_time | N/A | Yes |
| timeRange | The start and end time for the desired interval. The date format is MM/DD/YYYY HH:MM. For example, 1/1/2013%2000:00\~1/2/2013%2000:00. The maximum time range is 6 months | N/A | Yes |
| timeUnit | second, minute, hour, day, week, month, quarter, year, decade, century, millennium | N/A | Yes |
| sortby | When two or more select values are specified, 'sortby' can be used to specify the select used for sorting results: message_count, error_count, total_response_time, max_response_time, min_response_time, data_exchange_size, end_point_response_time | N/A | No |
| sort | Supported sort scopes are DESC or ASC | N/A | No |
| topk | Take "top k" results from results, for example, to return the top 5 results "topk=5". | N/A | No |
| filter | Enables drill-down on specific dimension values | N/A | No |
| limit | Set the limit for the number of entries returned by the API | N/A | No |
| offset | Use offset with limit to enable pagination of results. For example, to display results 11-20, set limit to '10' and offset to '10'. | N/A | No |

**Sample Response:**

```
{
  "environments" : [ {
        "dimensions" : [ {
          "metrics" : [ 
                 {
                "name" : "message_count",
                "values" : [ {
                   "timestamp" : 1335241800000,
                   "value" : "1.0"
                 } ]
              } ,
                 {
                 "name" : "error_count",
                 "values" : [ {
                    "timestamp" : 1335241800000,
                    "value" : "0.0"
                   } ]
            } 
              ],
        
               "name" : "api1"
        }, 
            {
          "metrics" : [ 
               {
              "name" : "message_count",
              "values" : [ {
                     "timestamp" : 1335241800000,
                     "value" : "1.0"
                  } ]
             },
                {
                "name" : "error_count",
                "values" : [ {
                      "timestamp" : 1335241800000,
                      "value" : "0.0"
                } ]
            } 
             ],
        
             "name" : "api2"
        } 
          ],
        
         "name" : "test"
      } 
    ],
   "metaData" : {
    }
}
```
**Response Payload Elements:**

| Name | Description |
|---|---|
| metadata | Metadata associated with the report |
| environments | Environments in the organization where the statistics are collected (supports wildcard \* for cross environment statistics collection) |
| metrics | The values returned for the specified dimension |
| dimensions | The dimension defined for measurement: in this example api_name. |
| metrics | Metrics for the report |