Bobcares

Google Cloud Endpoints OpenAPI | In-depth Guide

by | Apr 22, 2022

Google Cloud Endpoints OpenAPI leaving you frustrated? Find out how to deploy Endpoints & more.

At Bobcares, we offer solutions for every query, big and small, as a part of our Google Cloud Platform Support.

Let’s take a look at how our Google Cloud Support Team is ready to help customers with Google Cloud Endpoints for OpenAPI.

All About Google Cloud Endpoints OpenAPI

Google Cloud endpoints can be described as an API management system that secures, monitors, and analyzes as well as sets quotas on the APIs via the same infrastructure Google relies on for its own APIs. Furthermore, Endpoints work with Extensible Service Proxy and the Extensible Service Proxy V2 to offer API management.

Additionally, Endpoints support OpenAPI Specification version 2. Today, our experts are going to take us through using Endpoints with OpenAPI.

Google Cloud Endpoints OpenAPI

How to start Cloud Shell

  1. First, head to the Google Cloud Console and create or select an existing Google Cloud project.
  2. Then, open Cloud Shell.
  3. If we are using an existing project, we have to check if we have the latest gcloud components with the following command:
    gcloud components update

How to deploy Endpoints configuration

Before we start, run the following command in Cloud Shell to get sample API and scripts:

git clone https://github.com/GoogleCloudPlatform/endpoints-quickstart

After that, change to the directory with the sample code as seen below:

cd endpoints-quickstart

Now, we are going to deploy API’s OpenAPI configuration file to Service Management in order to use Endpoints to manage an API.

  1. First, navigate to the scripts directory in the endpoints-quickstart directory.
    cd scripts
  2. Then, run the following script. It is included in the sample:
    ./deploy_api.sh

Endpoints rely on the  OpenAPI configuration file’s host field to identify the service. In the above scenario, the deploy_api.sh script sets the ID of the Google Cloud project as part of the name in the host field. When we prepare an OpenAPI configuration file for our own service, we have to do this manually.

The script deploys the OpenAPI configuration with the following command:

gcloud endpoints services deploy openapi.yaml

openapi.yaml is a pre-configured OpenAPI file with the sample API comes.

After successful completion of creating and configuring the service, we will get the following output:

    Service Configuration [2022-02-23-r2] uploaded for service [airports-api.endpoints.example-project.cloud.goog]

Our Support Techs would like to point out that Endpoints requires the Google services to be enabled at a minimum:

  • servicemanagement.googleapis.com
  • servicecontrol.googleapis.com
  • endpoints.googleapis.com

We can use the command below to access a list of enabled services:

gcloud services list

After that, enable the Endpoints service:

gcloud services enable ProjectID.appspot.com

The next step involves deploying the API backend.

  1. Head to endpoints-quickstart/scripts directory in Cloud Shell and run:
    ./deploy_app.sh
  2. Then, deploy the sample API to the App engine with gcloud app deploy command.

Supported Compute Platforms

For API management, OpenAPI endpoints use either ESP or ESPv2. ESP and ESPv2 are both Open Source projects that are available in the following ways:

  • A container in Google Container Registry
  • Source code in GitHub

We can run the ESP container on:

  • App Engine flexible environment
  • Compute Engine
  • A Linux or macOS computer or another platform
  • Kubernetes, including Google Kubernetes Engine

Additionally, we can run the ESP2 container on:

  • App Engine
  • Cloud Run
  • Cloud Run for Anthos
  • Compute Engine
  • Cloud Functions
  • GKE
  • Kubernetes

[Need assistance with another query? We are available 24/7.]

Conclusion

In brief, our skilled Google Platform Support Engineers at Bobcares demonstrated how to deploy and enable Google Cloud Endpoints OpenAPI.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.