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 metrics

Resource Summary

Security

Content Type

Category

Analytics,

GetAPImessagecountspermonth

GET

Get metrics

Use this API call to get metrics per time interval for an organization and environment. If you are using Edge Microgateway with the analytics plugin enabled (default), API calls to Edge Microgateway are included in the count.

 

If you have multiple organizations and environments, make this API call for each one and add them to get the total number of calls per time interval for your API program.

 

To convert the JSON response to a CSV format for use in spreadsheets, use a tool like https://json-csv.com/

 

For more granular metrics, use the Get metrics organized by dimensions management API. That API lets you get metrics for a specified dimension. For example, metrics per API proxy, by developer, by developer app, and for many other dimensions. For more information on the analytics management API, see Use the analytics API to measure API program performance.

 

You can also try this API Traffic Summarizer tool to get and graph traffic data by API proxy over a specific time range.

Metrics

The types of metrics you can retrieve (specifid by the select query parameter) include traffic, message counts, API call latency, response size, and cache hits and counts. The documentation on metrics contains a table that specifies the metric name to use with the select query parameter and the function (sum, avg, min, max) supported by the metric.

 

For example, to get the average request size for your APIs, set the select query param as:

 

select=avg(request_size)

 

To get metrics for the sum of policy errors, transactions per second, and the average request size, set the select query param as:

 

select=sum(policy_error),tps,avg(request_size)

Metrics API quotas

Edge enforces a quota on these calls. The quota is based on the backend system that handles the call:

  • Postgres: limited to 40 calls per minute.
  • BigQuery: limited to 12 calls per minute.

Determine the backend system that handles the call by examining the response object. Every response object contains a metaData property that lists service that handled the call in the Source property. For example, for Postgres:

{
  ...
  "metaData": {
    "errors": [],
    "notices": [
      "Source:Postgres",
      "Table used: xxxxxx.yyyyy",
      "query served by:111-222-333"
    ]
  }
}

For BigQuery, the Source property is:

"Source:Big Query"

Resource URL

https://api.enterprise.apigee.com/v1 /organizations/{org_name}/environments/{env_name}/stats/

Query Parameters

Name Values Description
select
(required)

Designates one or more metrics to be aggregated for the report. For descriptions, see the Metrics. The documentation on metrics contains a table that specifies the metric name to use with the select query parameter and the function (sum, avg, min, max) supported by the metric.

Following are examples of supported metrics and aggregate functions:

sum(ax_cache_executed)
avg|min|max(ax_cache_l1_count)
sum(cache_hit)
sum(is_error)
sum(message_count)
sum(policy_error)
avg|min|max(request_processing_latency)
sum|avg|min|max(request_size)
avg|min|max(response_processing_latency)
sum|avg|min|max(response_size)
sum(target_error)
sum|avg|min|max(target_response_time)
sum|avg|min|max(total_response_time)
tps (Currently must use with another metric)

Separate more than one metric with a comma. For example:

sum(message_count),tps

timeRange
(required)

The UTC start and end time for the desired interval. The date format is MM/DD/YYYY HH:MM. For example, 03/01/2016 00:00~03/31/2016 23:59 returns data for the month of March 2016.

If you make a request through this SmartDocs page, it automatically URL encodes the space character before HH:MM. However, if you are entering the time range in a cURL command from the command line, manually insert "%20" for the space character, in the form: MM/DD/YYYY%20HH:MM~MM/DD/YYYY%20HH:MM. (See the cURL tab below after you make a request.)

By default, the timeRange parameter specifies a UTC start and end time. To change the time zone from UTC to a different time zone, use the tzo parameter to set the offset, in minutes, from UTC to the desired time zone.

Note: Data older than six months from the current date is not accessible by default. If you want to access data older than six months, contact Apigee Support.

timeUnit

Leave this blank to return the total number of API calls. However, if you want to return counts in time intervals, specify a value of second, minute, hour, day, or week.

The Epoch timestamp in milliseconds that is returned is the start time of each interval.

Note: second is not supported for Edge for the Private Cloud.

tzo

By default, the timeRange parameter specifies a UTC start and end time. To change the time zone from UTC to a different time zone, use the tzo parameter to set the offset, in minutes, from UTC to the desired time zone.

For example, the East coast of the United States is in the EST time zone. To change the time zone to EST, set tzo to -240. For California, in the PST timezone, set the offset to -480 minutes. For Bangalore, in the IST timezone, set the offset to 330 minutes.

Request Body

org_name Mention the organization name true

env_name Mention the environment name, such as test or prod true

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?)