Manage collections using the API

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

Collections enable you to group API proxies, targets, or developer apps and set up appropriate threshold values for all members of the group to diagnose issues faster.

The following sections describe how to manage collections using the API.

See Collections API for more on the collections API.

Create collections using the API

Create a collection of API proxies by issuing a POST request to the following resource: https://apimonitoring.enterprise.apigee.com/collections

The following example shows how to create a collection.

curl 'https://apimonitoring.enterprise.apigee.com/collections' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"My Collection",
     "description":"My collection for critical APIs",
     "environment": "prod",
     "type": "proxy",
     "members":["proxy1", "proxy2"]
    }'

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.

You can specify the type value as proxy, target, or developerApp. For example, to create a collection of developer apps:

curl 'https://apimonitoring.enterprise.apigee.com/collections' \
  -X POST \
  -H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json"\
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
     "organization":"myorg",
     "name":"My Dev App Collection",
     "description":"My collection for critical apps",
     "environment": "prod",
     "type": "developerApp",
     "members":["app1", "app2"]
    }'

View all collections using the API

View all alerts and notifications by issuing a GET request to the following resource: https://apimonitoring.enterprise.apigee.com/collections

You must pass the name of your organization using the org query parameter.

For example:

curl 'https://apimonitoring.enterprise.apigee.com/collections?org=myorg' 
  -X GET
  -H 'Accept: application/json, text/plain, */*' 
  -H "Authorization: Bearer $ACCESS_TOKEN"    

The following provides an example of the response:

[{
     "uuid":"1234abcd",
     "organization":"myorg",
     "environment": "prod",
     "name":"My Collection",
     "type": "proxy",
     "members":["proxy1", "proxy2"],
     "description":"My collection for critical APIs",
     "updatedAt":"2018-07-13T16:25:15Z",
     "updatedBy":"joe@acme.com"
}]

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.

Append the uuid of the collection to the /collections resource to view the specific collection:

curl 'https://apimonitoring.enterprise.apigee.com/collections/1234abcd?org=myorg'
  -X GET
  -H 'Accept: application/json, text/plain, */*' 
  -H "Authorization: Bearer $ACCESS_TOKEN"