Manage API proxies using the API (Alpha)

The following sections step through a sample scenario that demonstrates how you can create and manage your API proxies using the API. For a complete list of the Apigee APIs supported, see Apigee API reference.

Create an API proxy using the API

Create an API proxy in your Apigee organization by issuing a POST request to the following resource: https://apigee.googleapis.com/v1/organizations/{organizationId}/apis

You must define the name of the API proxy using the name query parameter. Restrict the characters used in the name to the following: A-Za-z0-9._\-$ %

Optionally, you can import an API proxy configuration bundle by performing the following steps:

  • Set the action query parameter to import.
  • Set the Content-type header to multipart/form-data
  • Pass the name of the API proxy configuration bundle on your local file system.

The following example demonstrates how to create an API proxy by importing an API proxy configuration bundle (helloworld-config.zip) on your local file system using the API.

curl "https://apigee.googleapis.com/v1/organizations/myorg/apis?name=helloworld&action=import" \
-X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-type: multipart/form-data" \
-F "file=@helloworld-config.zip"

Where $TOKEN is set 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.

The following provides an example of the response output:

{
  "basepaths": [
    "/helloworld"
  ],
  "configurationVersion": {
    "majorVersion": 4
  },
  "createdAt": "1559145292799",
  "displayName": "helloworld",
  "entityMetaDataAsProperties": {
    "bundle_type": "zip",
    "subType": "Proxy",
    "lastModifiedAt": "1559145292799",
    "createdAt": "1559145292799"
  },
  "lastModifiedAt": "1559145292799",
  "name": "helloworld",
  "policies": [
    "verify-api-key",
    "remove-query-param-apikey",
    "OAuth-v20-1"
  ],
  "proxies": [
    "default"
  ],
  "proxyEndpoints": [
    "default"
  ],
  "resourceFiles": {},
  "targetEndpoints": [
    "default"
  ],
  "targets": [
    "default"
  ],
  "type": "Application",
  "revision": "1",
  "description": "Hello world"
}

For more information, see the Method: organizations.apis.create in the Apigee API reference.

View all API proxies in your Apigee organization using the API

View all API proxies in your Apigee organization by issuing a GET request to the following resource: https://apigee.googleapis.com/v1/organizations/{organizationId}/apis

Where {organizationId} is the name of your Apigee organization.

For example:

curl "https://apigee.googleapis.com/v1/organizations/myorg/apis" \
-X GET \
-H "Authorization: Bearer $TOKEN"

Where $TOKEN is set 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.

The following provides an example of the response. Notice that the list includes the helloworld API proxy created and imported in the previous section.

{
  "proxies": [
    {
      "name": "helloworld"
    },
    {
      "name": "weather"
    },
    {
      "name": "testproxy"
    }
  ]
}

For more information, see the Method: organizations.apis.list in the Apigee API reference.

View details about an API proxy using the API

View the following details for your API proxy deployments:

  • API proxy name and revision number
  • Creation date
  • Last modified date

View details about an API proxy by issuing a GET request to the following resource https://apigee.googleapis.com/v1/organizations/{organizationId}/apis/{api_id}

Where:

  • {organizationId} is the name of your Apigee organization.
  • {api_id} is the name of your API proxy.

For example, to display more details about the helloworld API proxy:

curl "https://apigee.googleapis.com/v1/organizations/myorg/apis/helloworld" \
-X GET \
-H "Authorization: Bearer $TOKEN"

Where $TOKEN is set 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.

The following provides an example of the helloworld API proxy details.

{
  "metaData": {
    "createdAt": 1559145292799,
    "lastModifiedAt": 1559145292799,
    "subType": "Proxy"
  },
  "name": "helloworld",
  "revision": [
    "1"
  ]
}

For more information, see the Method: organizations.apis.get in the Apigee API reference.

Delete an API proxy using the API

Delete an API proxy in your Apigee organization by issuing a DELETE request to the following resource: https://apigee.googleapis.com/v1/organizations/{organizationId}/apis/{api_id}

Where:

  • {organizationId} is the name of your Apigee organization.
  • {api_id} is the name of the API proxy.

For example, to delete the helloworld API proxy:

curl "https://apigee.googleapis.com/v1/organizations/myorg/apis/helloworld" \
-X DELETE \
-H "Authorization: Bearer $TOKEN"

Where $TOKEN is set 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.

The following provides an example of the response output:

{
  "metaData": {
    "createdAt": "1559145292799",
    "lastModifiedAt": "1559145292799",
    "subType": "Proxy"
  },
  "name": "helloworld",
  "revision": [
    "1"
  ]
}

For more information, see the Method: organizations.apis.delete in the Apigee API reference.