Use the API Monitoring Management API

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

Use the API Monitoring management API to perform the following tasks.

Task More Information
Manage alerts for API Monitoring
Manage collections for API Monitoring
View API Monitoring logs at different levels
View API Monitoring metrics

API call quotas

All API Monitoring APIs enforce a quota that limits the number of times you can call the API per minute. For example, the Create collections API limits you to six calls per minutes.

Not all APIs have the same quota limits. See the API reference documentation on each API to determine its limit.

Use curl

The API examples in this document use curl to demonstrate how to use API Monitoring using the API. curl is an open source, command-line tool for transferring data with URL syntax, supporting common protocols such as HTTP and HTTPS. For information about downloading and using curl, see https://curl.haxx.se/.

The following table summarizes the curl command-line options used in the examples.

Option Description
-d '{}'

--data @filename

Defines the request body, passed directly or by specifying a filename.
-H

--header

Defines a request header. You must pass the following information in the request header:
  • OAuth 2.0 token for user authentication using Authorization header, as described in Obtaining an OAuth 2.0 access token.
  • Content types supported by the client using the Accept header.
  • Content type of the request body being sent when creating or updating a resource (POST, PATCH, PUT) using the Content-Type header.
-i Displays more information, such as headers, in the response.
-X Specifies the type of request (GET, POST, and so on).

Obtain an OAuth 2.0 access token

Apigee Edge supports OAuth 2.0 for user authentication. With OAuth 2.0, you exchange your Apigee Edge credentials for an access token and a refresh token that you can then use to make secure calls to the Apigee Edge API. Once you obtain a token, you do not need to exchange your credentials again until the token expires. The refresh token allows you to keep your "session" with the server alive for a longer period without providing your credentials. For more information about access tokens, see Using OAuth2 to access the management API.

Using your Apigee Edge credentials, you can obtain OAuth 2.0 access and refresh tokens to access Apigee Edge resources using Apigee's get_token utility.

To obtain an OAuth 2.0 access token:

  1. Install the get_token utility. For information about how to install the get_token utility, see Using get_token.

  2. Execute get_token to obtain an OAuth 2.0 access token.

    The first time you enter the command or if the refresh token has expired, get_token prompts you for your username, password, and the six-digit two-factor authentication code. Enter each value when prompted. If you do not have two-factor authentication enabled, simply press Enter at the prompt.

  3. Copy the OAuth 2.0 token and store it in a variable, such as ACCESS_TOKEN:

    export ACCESS_TOKEN=eyJhbG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-wIrywvjNf6FczjdktB1lpKJ2oRXx1n8PuK5FhOQ4wE9VeSsNsMHVcGvJ5W6Tvi61fo2h1w1d4AKvGdERzuVf_XWN00mtcgwsUAuXV0r5H_i3vxcMuUym1XOg
    
    

When you call the API Monitoring API, pass the OAuth 2.0 access token in the HTTP header using the Authorization header. For example:


curl -X GET "https://apimonitoring.enterprise.apigee.com/alerts?org=myorg"
   -H "Authorization: Bearer $ACCESS_TOKEN" 
   ...