You are viewing the Apigee Management API reference documentation. For the main product docs, and to search all docs, go to https://docs.apigee.com. For cross-site search, click Search all in the search results.

Get Traffic Metrics

Resource Summary

Security

Content Type

application/json, text/plain

Category

API Monitoring Metrics,

GetTrafficMetrics

GET

Get Traffic Metrics

Get traffic metrics. Specify filters such as proxy name, interval, time window, target, status code, and many others.

Setting groupBy and env

The groupBy query parameter specifies how to aggregate metrics. The env query parameter specifies to filter results by a specific environment name. You must specify either groupBy to include the "env" option, or specify an environment name to the env query param. For example:

groupBy=env // env query param is empty

or:

env=envName // groupBy query param is empty

where envName is the name of an environment, such as prod.

 

You can specify both query params. For example, the following settings aggregate metrics by environment, region, and organization and filters the results for the environment named prod:

groupBy=env,region,org&env=prod

Setting interval

The interval query parameter specifies the frequency that the metric is saved to the results. Each data point in the metric results is calculated over the preceding interval of time. For example, if interval is 10 minutes, then the metric is calcluated over the previous 10 minutes, and written to the results every 10 minutes.

 

The interval query parameter value support the following format:

  • <value><unit> where:
    • <value> – an integer
    • <unit> – a time unit of: u, mss, secmh, d, w

 

For example:

  • 1m
  • 10h
  • 2d

Setting to and from

By default, the API returns alerts for the previous one hour. Use the from and to query parameters to specify a different duration. The maximum duration specified by from and to is 24 hours.

 

The from and to query parameter values support the following formats:

  • now (current time)
  • -<value><unit> specifes a time in the past (note the leading hyphen):
    • <value> – an integer
    • <unit> – a time unit of: s, sec, second, m, min, minute, h, hr, hour, d, day
  • An ISO formatted date as either:
    • yyyy-mm-ddThh:mm:ssZ
    • yyyy-mm-ddThh:mm:ss+00:00

 

For example:

  • now
  • -1h
  • -10min
  • 2018-08-13T14:04:00+00:00

 

For more information and examples of this API, see View metrics data using the API.

Resource URL

https://apimonitoring.enterprise.apigee.com /metrics/traffic

Query Parameters

Name Values Description
org
(required)

Specify the name of the Edge organization.

interval
(required)

Specifies the frequency that the metric is saved to the results, and the interval over which the metric is calculated. See the description above about setting this parameter.

groupBy

Tags to aggregate metrics by in addition to region. Values include: env, org, region, proxy, target, statusCode, targetStatusCode, faultCodeName, faultCodeCategory, faultCodeSubCategory. Specify multiple values as a comma-separated list.

You must specify either groupBy to include the "env" option, or specify an environment name to the env query param. See the description above about setting this parameter.

env

Filter metrics by the specified environment. Specify multiple values as a comma-separated list.

You must specify either groupBy to include the "env" option, or specify an environment name to the env query param. See the description above about setting this parameter.

from
(required)

The beginning of the time interval for which metrics should be fetched. For example, -1h for one hour previous to the time specified by to. See the description above about setting this parameter.

to

The end of the time interval for which metrics should be fetched. The default value is the current time. See the description above about setting this parameter.

select

Metrics to query. Values include: count, rate, tps. Specify multiple values as a comma-separated list.

region

Filter metrics by the specified region. Specify multiple values as a comma-separated list.

developerApp

Filter metrics by the specified developer app. Specify multiple values as a comma-separated list.

proxy

Filter metrics by the specified API proxy name. Specify multiple values as a comma-separated list.

target

Filter metrics by the specified target domain name. Specify multiple values as a comma-separated list.

statusCode

Filter metrics by the specified HTTP status code. Values include: 2xx, 4xx 5xx, and errors, which includes all HTTP 4xx and 5xx status codes. You can also specify a specific HTTP status code, such as 203 or 404. Specify multiple values as a comma-separated list.

targetStatusCode

Filter metrics by the specified HTTP status code returned by the target. For example, 201, 404, or 501. You must specify an explicit status code. You cannot use wildcards such as 4xx or 5xx. Specify multiple values as a comma-separated list.

faultCodeName

Filter metrics by the specified fault code name. Specify multiple values as a comma-separated list.

faultCodeCategory

Filter metrics by the specified fault code category. Specify multiple values as a comma-separated list.

faultCodeSubCategory

Filter metrics by the specified fault code subcategory. Specify multiple values as a comma-separated list.

collection

Filter metrics by the UUID of the specified collection. Specify multiple values as a comma-separated list.

Header Parameters

Name Values Description
Authorization
(required)

OAuth token. Replace $TOKEN with your access token. See Get the tokens.

Request Body

HTTP Basic

OAuth 2.0

API Key

Reset

Make a request and see the response.

Make a request and see the response.

Make a request and see the response.

Working...

Help or comments?

  • If something's not working: Ask the Apigee Community or see Apigee Support.
  • If something's wrong with the docs: Click the "Send Feedback" button.
    (Incorrect? Unclear? Broken link? Typo?)