bg

Transform Your Supply Chain Planning and Marketing Strategies with Google Cloud and SAP Integration

Cloud Marketplace

API Management with Cloud Endpoints

April 29, 2021 | Meghanatha K L

Blog / API Management with Cloud Endpoints

Introduction

In this article, I hope to show you how the cloud endpoint will manage the APIs, why APIs are so important in the data world, and how they will manage their APIs.

Google Cloud Endpoints (CE) is GCP’s solution to build a RESTful API. It works great, although there are also a few gotchas that I’d like to share with you, Endpoints is a distributed API management system. It provides an API console, hosting, logging, monitoring, and other features to help you create, share, maintain, and secure your APIs.

 API management is the process of managing different API functions or methods, like API creation, securing, publication, and monitoring.

For making the best utilization of API, We need to provide high security and maintain proper documentation, regular versioning, thorough testing, high reliability, etc.

Managing APIs can be done with the help of the tool. This is where API management tools come into the picture and are becoming popular too.

Know more about Cloud Endpoints

Cloud Endpoints is one of the best solutions from Google, consists of many tools, libraries, and capabilities that allow you to generate the best efficient APIs and client libraries from a Google App Engine application, it helps you create a Public API for your App Engine application. With the help of Cloud Endpoints, we can easily create a web backend and it’s used for building web clients and mobile clients such as Android or Apple’s iOS.

Cloud Endpoints is an API management system with the help of this we can build efficient API’s and also it helps us to monitor, secure, analyze, and set quotas on our APIs using Google infrastructure, the same infrastructure Google uses for its own APIs, in the upcoming section I will going to discuss API’s and its working. 

What is an API and how it works?

The abbreviation of API is Application Programming Interface, which is a software intermediary it allows two applications to talk to each other. Each time you use many apps, send an instant message or check the weather on your laptop or phone, you’re using an API.

When you use an app on your mobile phone, the app connects to the Internet and sends data to a server. The server then finds that data, interpret it and performs some actions, and sends it back to your phone. The application then receives that data and presents you with the information in a readable way. This is what an API is and all of this happens via API

blog image

Features of cloud endpoints

  • Easy integration- We can use one of our Cloud Endpoints Frameworks or by simply using an OpenAPI specification to your deployment.

  • Manage your API’s- Develop, deploy, protect, and monitor your APIs with Cloud Endpoints. Using distributed architecture and NGINX-based proxy give unparalleled performance and scalability. Using an OpenAPI Specification or one of our API frameworks, Cloud Endpoints provides the tools it needs for every phase of API development and it will provide insight with Cloud Logging, Cloud Monitoring, and Cloud Trace.

  • Logging and monitoring- Monitor traffic, error rates, and latency, and review logs in Cloud Logging. Using Cloud Trace we can see performance and BigQuery for analysis.
  • Lightning fast- Extensible Service Proxy(ESP) delivers insight and security in less than 1 ms per call. We can Deploy  API automatically with App Engine and Google Kubernetes Engine, or add our proxy container to  Kubernetes deployment.

  • User authentication- We can use JSON Web Token validation and a streamlined developer experience for Firebase Authentication, Auth0, and Google Auth,.

  • Automated deployment- The proxy is deployed automatically with your application using App Engine and using Google Kubernetes Engine or Compute Engine we can deploy easily using our containerized ESP for simple deployment.

  • API keys- Generate API keys in Google Cloud Console and validate on every API call. We can share our API with other developers to allow them to generate their own keys.

To have your API managed by Cloud Endpoints, you have three options, depending on where your API is hosted and the type of communications protocol your API uses:

  1. Cloud Endpoints for OpenAPI
  2. Cloud Endpoints for gRPC
  3. Cloud Endpoints for Frameworks for the app engine standard environment

1. Cloud Endpoints for OpenAPI

An open API also called a public API, is an application programming interface made publicly available to software developers. Open APIs are shared freely and published on the internet, we can allow the owner of a network-accessible service to give universal access to consumers.

Endpoints support v2(version2) of the OpenAPI Specification, it’s formerly known as the Swagger spec and it’s the industry standard for defining REST APIs.

Endpoints for OpenAPI depend on either ESP(Extensible proxy service) or ESPv2 for API management. The ESP and ESPv2 are Open Source projects and available to you in the following ways:

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

We can run the ESP container on the following:

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

We can run the ESPv2 container on the following:

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

2. Cloud Endpoints for gRPC

gRPC is an open-source, high-performance universal RPC framework, It’s developed by Google. In gRPC, a client-side application can directly call functions on a server application, and also we can run on a different machine, making it easy to create distributed applications and services.

One of the best benefits of using gRPC is for documentation, using your service configuration and API interface definition files we can generate reference documentation for your API.

Endpoints work with either the ESP or the ESPv2+ to provide API management.

With Cloud Endpoints for gRPC, we can use the API management capabilities of Endpoints to add an API console, hosting, monitoring, authentication, tracing, and more to your gRPC services. We have the power to convert to gRPC requests like once you specify special mapping rules, ESP and ESPv2 translate RESTful JSON over HTTP into the gRPC requests. This means that you can deploy a gRPC server managed by Endpoints and call its API using a JSON/HTTP client or gRPC, giving you more flexibility and ease of integration with other systems.

The ESP and ESPv2 are Open Source projects and available to you in the following ways:

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

We can run the ESP container on the following:

  • Compute Engine with Docker
  • Kubernetes, including Google Kubernetes Engine
  • A macOS computer or Linux or another cloud provider

We can run the ESPv2 container on the following:

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

3. Cloud Endpoints for Frameworks for the app engine standard environment

Cloud Endpoints Frameworks is a web framework for the App Engine standard  Java 8 and Python 2.7 runtime environments, Endpoints Frameworks do not support the PHP, Go, or Node.js runtimes. We can get the tools and libraries in Cloud Endpoints Frameworks that allow you to generate REST APIs and client libraries for your application.

Like other web frameworks, Low-level communication details of HTTP requests and HTTP responses for your application are handled by Endpoints Frameworks. When a client sends a request to your API, Endpoints Frameworks routes the request’s URL to the function in your code that processes the request. Endpoints Frameworks receive the return value and convert the return value to JSON and send the response back. You add metadata to your source code ex- by using annotations and decorators in java and Python respectively. It will define the surface of the REST APIs for your application.

The ESP provides API management features for OpenAPI and gRPC. Each instance of your backend  ESP runs in a container.

In the App Engine standard environment it does not support multi-container deployments when frameworks under development, Frameworks did not use ESP. Instead, It includes a built-in API gateway that provides API management features that are comparable to the features that ESP provides for Endpoints for OpenAPI and Endpoints for gRPC.

Endpoints Frameworks intercepts all requests and it will check authentication before forwarding the request to the API backend. When the backend responds, Endpoints Frameworks collects and gives reports to telemetry. You can view metrics tools for your API on the Endpoints Services page in the Cloud Console.

We have the opportunity to use Endpoints Frameworks with or without API management functionality. Use of Endpoints Frameworks without API management functionality is offered at free cost and the API management functionality is charged for this feature.

 

 

Reference and further read: 

https://cloud.google.com/endpoints/docs
https://www.softwaretestinghelp.com/api-management-tools/
https://grpc.io/
https://blog.dreamfactory.com/grpc-vs-rest-how-does-grpc-compare-with-traditional-rest-apis/