A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/api-gateway/docs/creating-api below:

Creating an API | API Gateway Documentation

Skip to main content

Stay organized with collections Save and categorize content based on your preferences.

Creating an API Prerequisites

Before you can create an API on API Gateway, ensure that you have:

API ID requirements

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

Creating an API

To create an API:

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

    gcloud config list project

    If you need to change the default project, run the following command and replace PROJECT_ID with the Google Cloud project ID in which you want to create the service::

    gcloud config set project PROJECT_ID

    If your project ID contains a colon (:), see Domain-scoped projects for additional details about creating an API in your project.

  2. View help for the apis create command:

    gcloud api-gateway apis create --help
  3. Run the following command to create the API:

    gcloud api-gateway apis create API_ID --project=PROJECT_ID

    where:

    As it is creating the API, API Gateway outputs information to the terminal.

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

    gcloud api-gateway apis describe API_ID --project=PROJECT_ID

    This command returns the following:

    createTime: '2020-02-29T21:52:20.297426875Z'
    displayName: API_ID
    managedService: MANAGED_SERVICE_NAME.apigateway.PROJECT_ID.cloud.goog
    name: projects/PROJECT_ID/locations/global/apis/API_ID
    state: ACTIVE
    updateTime: '2020-02-29T21:52:20.647923711Z'
gcloud options

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

Domain-scoped projects

If your project is scoped to your domain, the project ID includes the name of the domain followed by a colon (:), for example, example.com:my-project. You must provide a valid managed service when creating an API in a domain-scoped project.

If using gcloud, provide the managed service name using the --managed-service flag, as described in gcloud options.

Note: Scoping projects to a domain is a legacy feature. You cannot create new domain-scoped projects. Listing APIs

To list all APIs in a project:

gcloud api-gateway apis list --project=PROJECT_ID

This command returns output in the form:

NAME                                              DISPLAY_NAME  MANAGED_SERVICE                          STATE
projects/PROJECT_ID/locations/global/apis/API_ID  API_ID        MANAGED_SERVICE_NAME.apigateway.PROJECT_ID.cloud.goog  ACTIVE

Use the project ID and API ID to obtain detailed information about the API:

gcloud api-gateway apis describe API_ID --project=PROJECT_ID
Updating an API

After creation, you can update the labels and display name of an existing API. Use the following gcloud options to update an existing API:

For example:

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

Use the following command to view all update options:

gcloud api-gateway apis update --help
Deleting an API

To delete an API you must:

Note: If you deployed an API config to a gateway, then deleting the API causes the gateway to stop serving traffic. However, you are not required to delete the gateway. Instead, you can deploy an API config from a different API to the gateway.

To delete an API:

  1. Determine the list of API configs associated with the API:

    gcloud api-gateway api-configs list --api=API_ID --project=PROJECT_ID
  2. Delete each API config associated with the API:

    gcloud api-gateway api-configs delete CONFIG_ID --api=API_ID --project=PROJECT_ID
  3. Delete the API:

    gcloud api-gateway apis delete API_ID --project=PROJECT_ID
What's next

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 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Before creating an API, ensure your development environment is properly configured and meets the API ID requirements, which include a maximum length of 63 characters, lowercase letters, numbers, or dashes, and no starting dashes or underscores."],["Use the `gcloud api-gateway apis create API_ID --project=PROJECT_ID` command to create a new API, where you specify the desired API ID and the Google Cloud project ID."],["After creation, the API's display name and labels can be updated using the `gcloud api-gateway apis update` command with options like `--display-name`, `--update-labels`, `--clear-labels`, and `--remove-labels`."],["To delete an API, you must first delete all associated API configs using `gcloud api-gateway api-configs delete`, and then delete the API itself with `gcloud api-gateway apis delete`."],["Listing all the existing APIs within a project can be done with the following command `gcloud api-gateway apis list --project=PROJECT_ID`."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4