All Products
Search
Document Center

API Gateway:Publish an API

Last Updated:Jul 08, 2025

This topic describes how to publish an API to a Cloud-native API Gateway instance. An instance provides an environment that is completely separated from another instance. This way, the API can run in different environments.

Prerequisites

An API is created and an operation is added to it. For more information, see Create a REST API and add an operation to it.

Procedure

  1. Log on to the Cloud-native API Gateway console.

  2. APIs can be published both inside and outside instances:

    APIs inside instances

    1. In the left-side navigation pane, click Cloud-native API Gateway > Instance. In the top navigation bar, select a region.

    2. On the Instance page, click the target instance ID.

    3. In the navigation pane on the left, click API, then click your target REST API.

    APIs outside instances

    1. In the left-side navigation pane, click Cloud-native API Gateway > API. In the top navigation bar, select a region.

    2. Click your target REST API.

  3. On the API details page, click Publish API in the upper-right corner.

    image

  4. In the Publish REST API panel, configure the parameters and click OK.

    • Parameters for APIs inside instances:

      Parameter

      Description

      Instance

      The cloud-native API gateway instance you created. Use different instances to distinguish business environments, enabling multi-environment API publishing.

      VPC

      The virtual private cloud (VPC) to which the instance interfaces belong.

      Publish Scope

      API-level interface publishing range. Select interface names to view affected endpoint details.

      Release Description

      Enter description for the API publishing operation.

    • Parameters for APIs outside instances:

      Parameter

      Description

      Domain Name

      Select a domain name to publish the API. The published API can be accessed by using the domain name.

      If no domain name is available, click Add Domain Name to create a domain name. For more information, see Create a domain name.

      Instance

      Select a cloud-native API gateway instance you created to publish. Use different instances to distinguish business environments, enabling multi-environment API publishing.

      Scenarios

      Select a scenario for which you want to publish the API. Scenarios fall into two categories: regular scenarios and canary release scenarios. Valid values: Mock, Single Service, By Percentage (Multi-service), and By Content (Multi-service).

      Regular scenario

      • Mock: In the Mock scenario, mocked responses configured in API operation definitions are returned for requests. If no mocked response is configured, the API operation is inaccessible.

        Note

        If you want to publish an API to the Mock scenario, you must make sure that a mocked response is configured for at least one operation in the API. Otherwise, the API fails to be published.

      • Single Service: In this scenario, all traffic is directed to a specific backend service. This is the most common scenario.

      Canary release scenario

      • By Percentage (Multi-service): Traffic is directed to configured backend services based on configured weights.

        Note

        The weights of all services must sum up to 100.

      • By Content (Multi-service): Traffic is directed to corresponding backend services based on the match conditions. If you select Default next to Match Condition, traffic is directed to the configured backend service when no other rules are hit.

        The following match condition types are supported: equal to, prefix, and regular expression.

        Supported parameter types: Query and Header.

        The "and" operation logic is used between multiple match conditions.

        Important

        You can select Default for only one entry.

      • By Tag (Proportion-based Routing): Traffic is directed to multiple versions of multiple backend services based on the proportion configurations. Single-service routing is recommended for end-to-end canary release for higher performance and better experience.

      Backend Services

      Associate backend services with the instance. If no backend service is available, click Create Service to create a service. For more information, see Create a service.

      Description

      Enter a description for the published API.