Creating an API config  |  API Gateway Documentation  |  Google Cloud (2024)

  • Home
  • API Gateway
  • Documentation
  • Guides
Stay organized with collections Save and categorize content based on your preferences.

Prerequisites

Before you can create an API config, ensure that you have:

  • Prepared your development environment as described in Configuring your development environment.

  • Created an API definition as an OpenAPI spec.

  • Optionally created an API as described in Creating an API. If the API does not already exist, then creating the API config creates it.

API config ID requirements

Many of the gcloud commands shown below require you to specify the ID of the API config, in the form: CONFIG_ID.API Gateway enforces the following requirements for the API config ID:

  • Must have a maximum length of 63 characters.
  • Must contain only lowercase letters, numbers, or dashes.
  • Must not start with a dash.
  • Must not contain an underscore.

Creating an API config

Use the Google Cloud CLI to upload your API definition to create an API config.When you upload the API definition, you are required to specify the name of the API.If the API does not already exist in API Gateway then this command also creates it.

To create an API config:

  1. Change directory to the directory containing your API definition.

    For more on creating the OpenAPI spec for your API definition, see OpenAPI overviewand Quickstart: Deploy an API on API Gateway.

    For more on creating a gRPC service definition and configuration for your API definition, see Configuring a gRPC serviceand Getting started with API Gateway and Cloud Run for gRPC.

  2. Validate the project ID returned from the following command to make sure thatthe service isn't created in the wrong project.

    gcloud config list project

    If you need to change the default project, run the following commandand replace PROJECT_ID with the Google Cloud project IDin which you want to create the service::

    gcloud config set project PROJECT_ID
  3. View help for the api-configs create command:

    gcloud api-gateway api-configs create --help
  4. Run the following command to create the API config:

    gcloud api-gateway api-configs create CONFIG_ID \ --api=API_ID --openapi-spec=API_DEFINITION \ --project=PROJECT_ID --backend-auth-service-account=SERVICE_ACCOUNT_EMAIL

    where:

    • CONFIG_ID specifies the ID of the new API config.
    • API_ID specifies the ID of the API Gateway API associated with this API config. If the API does not already exist then this command creates it.
    • API_DEFINITION specifies the name of the OpenAPI spec containing the API definition.
    • PROJECT_ID specifies the Google Cloud project ID.
    • SERVICE_ACCOUNT_EMAIL specifies the service account used to sign tokens for backends with authentication configured. See Configuring a service account for more details.

    As it is creating the API and API config, API Gateway outputsinformation to the terminal. This operation may take several minutes to complete as the API config is propagated to downstream systems. Creation of a complex API config could take up to ten minutes tocomplete successfully. While a config is being created, do not attempt tocreate another config for the same API. Only one config may be createdfor any API at a time.

  5. On successful completion, you can use the following command to view details about the new API config:

    gcloud api-gateway api-configs describe CONFIG_ID \ --api=API_ID --project=PROJECT_ID

    This command returns the following:

    createTime: '2020-02-04T18:33:11.882707149Z'displayName: CONFIG_IDgatewayConfig: backendConfig: googleServiceAccount: 1111111@developer.gserviceaccount.comlabels: ''name: projects/PROJECT_ID/locations/global/apis/API_ID/configs/CONFIG_IDserviceRollout: rolloutId: 2020-02-04r2state: ACTIVEupdateTime: '2020-02-04T18:33:12.219323647Z'
  6. Enable the API using the managed service name of the API. You can find this value in the Managed Service column for your API on the APIs landing page:

    gcloud services enable MANAGED_SERVICE_NAME.apigateway.PROJECT_ID.cloud.goog

    You only have to run this command once when you create the API. If you later modify the API, you do not have to rerun the command.

The Google Cloud CLI takes many options, including those described in thegcloud Reference. In addition,for API Gateway, you can set the following options when creating an API config:

  • --async: Return control to the terminal immediately, without waiting for the operation to complete.
  • --display-name=NAME: Specifies the display name of the API config, meaning the name shown in the UI. Do not use spaces in the name. Use hyphens and underscores instead. The default value is CONFIG_ID.
  • --labels=KEY1=VALUE1,KEY2=VALUE2,...: Specifies labels associated with the API config.

For example:

gcloud api-gateway api-configs create CONFIG_ID \ --api=API_ID --openapi-spec=API_DEFINITION \ --project=PROJECT_ID --backend-auth-service-account=SERVICE_ACCOUNT_EMAIL \ --async --display-name=MyConfig --labels=a=1,b=2

You can see the labels in the output of the describe command shown above, or in the list command by including the --format option:

gcloud api-gateway api-configs list \ --api=API_ID --project=PROJECT_ID --format="table(name, labels)"

Listing API configs

To list API configs for a specific project:

gcloud api-gateway api-configs list --project=PROJECT_ID

This command returns the following:

NAME DISPLAY_NAME ROLLOUT_ID STATE CREATE_TIMEprojects/PROJECT_ID/locations/global/apis/API_ID/configs/CONFIG_ID CONFIG_ID 2020-02-04r0 ACTIVE 2020-02-04T16:18:02.369859863Z

To list API configs for a specific API in a project:

gcloud api-gateway api-configs list --api=API_ID --project=PROJECT_ID

Use the project, API, and config IDs to obtain detailed information about the API config:

gcloud api-gateway api-configs describe CONFIG_ID \ --api=API_ID --project=PROJECT_ID

Updating an API config

You cannot modify an existing API config other than to update its labels and its display name.

Use the following gcloud to update an existing API config:

  • --display-name
  • --update-labels
  • --clear-labels
  • --remove-labels

For example:

gcloud api-gateway api-configs update CONFIG_ID \ --api=API_ID --project=PROJECT_ID \ --update-labels=a=1,b=2

Use the following command to view all update options:

gcloud api-gateway api-configs update --help

Deleting an API config

Use the following gcloud command to delete an existing API config:

gcloud api-gateway api-configs delete CONFIG_ID --api=API_ID --project=PROJECT_ID

What's next

  • Deploying an API to a gateway

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-09-10 UTC.

Creating an API config  |  API Gateway Documentation  |  Google Cloud (2024)

FAQs

How to configure API Gateway in GCP? ›

Go to the API Gateway console in your Google Cloud project. Create a new API and give it an appropriate name. Create a new API Config. Select Open API and provide a specification (if you have one) or define your API's paths manually.

How do I create an API Gateway documentation? ›

To document your API, you can call the API Gateway REST API, use one of the AWS SDKs , use the AWS CLI for API Gateway, or use the API Gateway console. In addition, you can import or export the documentation parts that are defined in an external OpenAPI file.

What are the limits of Google Cloud API Gateway? ›

API Gateway enforces the following limits on APIs, API configs, and gateways: APIs - 50 total. API Configs - 100 per API. Gateways - 5 per region.

How to set API configuration? ›

Creating an API config
  1. Prepared your development environment as described in Configuring your development environment.
  2. Created an API definition as an OpenAPI spec.
  3. Optionally created an API as described in Creating an API. If the API does not already exist, then creating the API config creates it.

What is the difference between load balancer and API Gateway? ›

Both services can function together, although they do not require each other to work. For instance, the API gateway connects between microservices. The load balancer redirects multiple instances of a microservice component (to scale the deployment).

How do I make a good API documentation? ›

API Documentation Best Practices
  1. Adopt clear language. ...
  2. Include reference documentation. ...
  3. Implement examples. ...
  4. Put someone in charge of the docs. ...
  5. Cover different types and topics. ...
  6. Incorporate documentation into processes. ...
  7. Provide quickstart guides.
Oct 21, 2022

Can I create my own API Gateway? ›

With the power of NodeJS and Express, let's create your API Gateway for your microservice on your own. API Gateway is the entry point of your entire internal APIs or services.

How do I auto generate API documentation? ›

4 Steps to Automatically Generate API Documentation for ASP.NET Core Projects
  1. Step 1: Include the Swagger namespace.
  2. Step 2: Then, register the Swagger service in the ConfigureServices method.
  3. Step 3: Enable Swagger middleware in the Configure method to configure Swagger UI.
Oct 3, 2022

How many requests can an API Gateway handle? ›

API Gateway has account-level quotas, per Region. The throttle quota is 10,000 requests per second (RPS) with an additional burst capacity provided by the token bucket algorithm. The maximum bucket capacity is 5,000 requests per account and Region.

How many VPC can be created in GCP? ›

The default limit for number of networks (such as a VPC) per project is 15. To check your quota, run this command with your project ID: gcloud compute project-info describe --project [PROJECT_ID] .

What is the maximum timeout for GCP API Gateway? ›

What is the default API Gateway timeout? Hi @cyrille115 , As per this discussion, the default timeout is originally 15 seconds, but can now be changed up to 60 seconds, as a result of feature request and consolidated concerns on PIT (public issue trackers).

How to create an API gateway in Google Cloud? ›

Create a GCP API
  1. If you have not already done so, go to the Google Cloud API Gateway screen by clicking on the GCP menu and selecting API Gateway.
  2. Click on CREATE GATEWAY.
  3. Enter the Display Name and the API ID (e.g. demo-api-display-name-for-external-function1 and demo-api-id-for-external-function1 ).

What is API gateway for beginners? ›

An API gateway accepts API requests from a client, processes them based on defined policies, directs them to the appropriate services, and combines the responses for a simplified user experience.

What is an example of an API gateway? ›

The popular example of API Gateway is Netflix API Gateway. The Netflix streaming services are available on hundreds of different kinds of devices such as televisions, set-top boxes, smartphones, tablets, etc. It attempts to provide a one-size-fits-all API for its streaming service.

How to create a gateway in GCP? ›

To add the gateway to your project, enable the Connect gateway API and its required dependency APIs. If your users only want to authenticate to clusters using the Google Cloud console you don't need to enable connectgateway.googleapis.com , but you do need to enable the other APIs. See more code actions.

How do I create an API Gateway role? ›

To create an Amazon API Gateway type of role
  1. Choose Roles from the main navigation pane.
  2. Choose Create New Role.
  3. Type a name for Role name and then choose Next Step.
  4. Under Select Role Type, in AWS Service Roles, choose Select next to Amazon API Gateway.

How do I give access to API Gateway? ›

Here are the mechanisms you can use for authentication and authorization:
  1. API Gateway resource policies. ...
  2. IAM permissions. ...
  3. Use VPC endpoint policies for private APIs in API Gateway. ...
  4. Using tags to control access to API Gateway resources. ...
  5. API Gateway Lambda authorizers. ...
  6. Amazon Cognito user pools with authorizer permissions.

How do I enable access to API in GCP? ›

Enable an API
  1. Go to the API Console.
  2. From the projects list, select a project or create a new one.
  3. If the APIs & services page isn't already open, open the console left side menu and select APIs & services, and then select Library.
  4. Click the API you want to enable. ...
  5. Click ENABLE.

Top Articles
Online Shopping with Home Credit | Easy Payment Options
Available chart types in Office
Frases para un bendecido domingo: llena tu día con palabras de gratitud y esperanza - Blogfrases
Celebrity Extra
Hertz Car Rental Partnership | Uber
Paula Deen Italian Cream Cake
Vocabulario A Level 2 Pp 36 40 Answers Key
Umn Biology
Www.paystubportal.com/7-11 Login
Pollen Count Central Islip
今月のSpotify Japanese Hip Hopベスト作品 -2024/08-|K.EG
George The Animal Steele Gif
Labor Gigs On Craigslist
Illinois Gun Shows 2022
Cashtapp Atm Near Me
Craigslist Southern Oregon Coast
Dragger Games For The Brain
Craigslist Battle Ground Washington
Imouto Wa Gal Kawaii - Episode 2
Kimoriiii Fansly
Craigslist Pasco Kennewick Richland Washington
When His Eyes Opened Chapter 3123
Sams Gas Price Sanford Fl
Rural King Credit Card Minimum Credit Score
Renfield Showtimes Near Marquee Cinemas - Wakefield 12
Edward Walk In Clinic Plainfield Il
W B Crumel Funeral Home Obituaries
Best Weapons For Psyker Darktide
Pillowtalk Podcast Interview Turns Into 3Some
Solemn Behavior Antonym
New Gold Lee
Frcp 47
1v1.LOL Game [Unblocked] | Play Online
Craigslist Tulsa Ok Farm And Garden
Discover Wisconsin Season 16
Oppenheimer Showtimes Near B&B Theatres Liberty Cinema 12
Www.craigslist.com Waco
Myrtle Beach Craigs List
Az Unblocked Games: Complete with ease | airSlate SignNow
Hampton In And Suites Near Me
CrossFit 101
RubberDucks Front Office
Booknet.com Contract Marriage 2
Server Jobs Near
Sc Pick 3 Past 30 Days Midday
Mejores páginas para ver deportes gratis y online - VidaBytes
Stephen Dilbeck, The First Hicks Baby: 5 Fast Facts You Need to Know
Wrentham Outlets Hours Sunday
Osrs Vorkath Combat Achievements
Metra Union Pacific West Schedule
Bellin Employee Portal
login.microsoftonline.com Reviews | scam or legit check
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 6073

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.