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:

    {
      "deployments": [
        {
          "environment": "test",
          "apiProxy": "myproxy",
          "revision": "1",
          "deployStartTime": "1560782439002",
          "pods": [
            {
              "podName": "apigee-runtime-my-organization-test-blue-56b642fv429v",
              "appVersion": "self",
              "deploymentStatusTime": "1560787671389",
              "deploymentStatus": "deployed",
              "statusCode": "200",
              "statusCodeDetails": "Deployment Success",
              "deploymentTime": "1560782471370",
              "podStatus": "active",
              "podStatusTime": "1560787671389"
            },
            {
              "podName": "apigee-runtime-my-organization-test-blue-564422f7dmwj",
              "appVersion": "self",
              "deploymentStatusTime": "1560787670121",
              "deploymentStatus": "deployed",
              "statusCode": "200",
              "statusCodeDetails": "Deployment Success",
              "deploymentTime": "1560782485204",
              "podStatus": "active",
              "podStatusTime": "1560787670121"
            }
          ],
          "basePath": "/"
        }
      ]
    }

    This example response shows the API proxy's status on 2 pods. The deployment status is deployed on both pods.

    Your response might show the deployment status of you API proxy on fewer or more pods, depending on your cluster's configuration.

    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.

This sections describes other techniques you can use to verify that your proxies are synchronized and deployed.

List deployed proxies

Use the classification/tree API to list proxies deployed to the MP:

  1. Get the names of the pods in your cluster:
    kubectl get pods -n namespace
  2. Use port-forwarding to gain access the apigee-runtime pod. The syntax for port forwarding is as follows:
    kubectl port-forward -n namespace podname 8843:8843

    For example:

    kubectl port-forward -n apigee \
        apigee-runtime-my-organization-test-blue-57965b7789-6j4bp 8843:8843
  3. Then, in another terminal window, use a utility such as curl to send a request to the classification/tree API, as the following example shows:
    curl -k https://0:8843/v1/classification/tree

    Here is an example response, which lists information about the deployed proxies in the "test" environment:

    [ {
      "condition" : "(always matches)",
      "virtualHost" : {
        "env" : "test",
        "name" : "default",
        "org" : "my-organization",
        "tree" : {
          "elements" : [ {
            "application" : "myproxy",
            "basePath" : "/myproxy",
            "name" : "default",
            "revision" : "1"
          } ],
          "name" : "IdentificationTree"
        }
      }
    } ]