Check your API proxy's deployment status using the API

This section describes how to check the deployment status of an API proxy using the Apigee APIs.

  1. Deploy a test API proxy as explained in Create and deploy a new API proxy.
  2. Locate the JSON file with the Apigee Organization Admin service account key. This service account and key was created in Enable synchronizer access.
  3. Execute these two commands to get a token:
    export GOOGLE_APPLICATION_CREDENTIALS=org-admin-service-account-file
    export TOKEN=$(gcloud auth application-default print-access-token)

    Where org-admin-service-account-file is the path on your system to the service account key you downloaded with the Apigee Organization Admin role.

  4. Call the revisions API, with the following parts:
    • Base URL: https://apigee.googleapis.com/v1
    • Endpoint URL: /organizations/my-organization/environments/test/apis/myproxy/revisions/1/deployments
    • Protocol: HTTPS
    • Method: GET
    • Headers: "Authorization: Bearer $TOKEN"

    The following example calls the deployment revisions API with these settings using curl:

    curl "https://apigee.googleapis.com/v1/organizations/my-organization/environments/test/apis/myproxy/revisions/1/deployments" \
    -X GET -H "Authorization: Bearer $TOKEN"

    You should receive a response similar to the following:

    {
      "environment": "test",
      "apiProxy": "myproxy",
      "revision": "1",
      "deployStartTime": "1616787712821",
      "state": "READY",
      "instances": [
        {
          "instance": "hybrid-docs-id",
          "deployedRevisions": [
            {
              "revision": "2",
              "percentage": 100
            }
          ],
          "deployedRoutes": [
            {
              "basepath": "/myproxy",
              "envgroup": "test-group",
              "environment": "test",
              "percentage": 100
            }
          ]
        }
      ]
    }

    This example response shows the API proxy's status is READY, indicating a successful deployment.

    If you get an empty response or an error, check that:

    • You used the correct base URL. Note that the hybrid base URL is not the same as the Edge API's base URL. Use https://apigee.googleapis.com/v1.
    • You used the correct endpoint URL. Note that the revision is "1" and the endpoint is /organizations/my_organization/environments/test/apis/myproxy/revisions/1/deployments. If you specify a revision that doesn't exist, the request results in an empty response like the following:
      { }
    • You have permissions to access the organization that you specify in the request.
    • Your token has not expired. If it has, regenerate a new one as described in Obtain an OAuth 2.0 access token.
    • You wrapped the "Authorization: Bearer $TOKEN" header in quotes.