View events

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

Use the /metrics/events API to get all events in an organization for a specified time interval. The list of events includes all alerts detected by Edge.

By default, the API returns all events for the previous hour. Use the from and to query parameters to specify a different duration. The from and to query parameter values support the following formats:

  • now (current local time)
  • -<value><unit> specifies 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
  • 2019-05-13T14:04:00+00:00

Only the org query parameter is required. The following API call returns all events in the organization myorg for the previous 12 hours:

curl -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://apimonitoring.enterprise.apigee.com/metrics/events?org=myorg&from=-12h&to=now"

Set $ACCESS_TOKEN to your OAuth 2.0 access token, as described in Obtain an OAuth 2.0 access token. For information about the curl options used in this example, see Use curl.

This API supports the following optional query parameters:

Name Description Default
from The beginning of the time interval for which alerts should be fetched. The default value is the current time minus one hour. See the description above about setting this parameter. -1h
to The end of the time interval for which alerts should be fetched. The default value is the current time. See the description above about setting this parameter. now
alertId Filter alert history results by the specified alert definition ID. All alert IDs
env Filter events by the specified environment. All environments
name Filter events by the specified alert name. All alert names
region Filter events by the specified region. All regions
type Filter events by the specified type: alert. All types