Adding API Management

For your API to be fully supported by Google Cloud Endpoints, follow the steps on this page to add API management support. Note that if you do not add API management support, your API will still serve requests, but your API will not appear in the Endpoints dashboard in the Cloud Console, and the functionality provided by Cloud Endpoints (such as authentication, logging, monitoring, etc.) will not be available.

To add API management support to your API:

  1. Add the frameworks library to your API project directory so it will be uploaded with the API code upon deployment:

    1. Change directory to your API's main directory.
    2. Make a /lib subdirectory in the API’s main directory:

      mkdir lib
    3. Install the library:

      pip install -t lib google-endpoints --ignore-installed

      Notice that this library is vendored in the file in your API main directory.

  2. From the API’s main directory, generate an OpenAPI document using the framework tools, for example:

    python lib/endpoints/ get_openapi_spec main.EchoApi --hostname [YOUR-PROJECT-ID]

    Replace [YOUR-PROJECT-ID] with your project ID. Ignore the warnings that are displayed.

  3. Deploy the configuration file:

    gcloud service-management deploy echov1openapi.json
  4. Display the service configuration version by invoking the command:

    gcloud service-management configs list --service=[YOUR-PROJECT-ID]

    replacing [YOUR-PROJECT-ID] with your project ID.

  5. Edit your project's file app.yaml env_variables section as follows:


    Replace [YOUR-PROJECT-ID] with your project ID, and [YOUR-SERVICE-VERSION] with your service configuration version from the previous step. (Do not include the square brackets.)

  6. Re-deploy your API:

    gcloud app deploy
  7. Wait a few moments for the deployment to succeed, ignoring the warning messages. When the deployment completes, you'll see a message similar to the following:

    File upload done.
    Updating service [default]...done.
  8. Test for a successful re-deployment, for example, using cURL:

    curl -H "Content-Type: application/json" -X POST -d '{"content":"echo"}' https://[PROJECT-ID]

    Replace [PROJECT-ID] with your project ID; replace echo with the name of your API.

    View the results: you should see something like:

     "content": "echo echo"

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Endpoints Frameworks for App Engine