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 Adminrole.

  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.