Updated on 2022-02-21 GMT+08:00

Importing APIs

Scenario

API Gateway supports the import of APIs defined in accordance with Swagger 2.0 into an existing or a new API group. Swagger is a suite of open-source API developer tools that comply with OpenAPI Specification and help you design, build, document, and use REST APIs.

You can import APIs individually or in batches depending on the number of APIs contained in a Swagger file.

Prerequisites

  • The API Swagger file to be imported is available and already has extended API definitions supplemented. For more information, see .
  • You have sufficient quotas of API groups and APIs.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and choose API Gateway.
  3. In the navigation pane, choose API Publishing > APIs.
  4. Click Import API.
  5. Set the parameters listed in Table 1.

    Table 1 Parameters for importing APIs

    Parameter

    Description

    Import

    Options:

    • New group: Import APIs to a new API group. If you select this option, the system automatically creates a new API group and imports the APIs into this group.
    • Existing group: Import APIs to an existing API group. If you select this option, the system adds the APIs to the selected API group while retaining the existing APIs in the API group.

    API group

    Select an API group if you set Import to Existing group.

    Basic Definition Overwrite

    Determine whether to overwrite the basic definition of an existing API if the name of the API is the same as that of an imported API.

    This parameter is available only if you set Import to Existing group.

    Extended Definition Overwrite

    Determine whether to overwrite the extended definition (such as access control and request throttling policies) of an existing API if the extended definition name of the API is the same as that of an imported API.

  6. In the Parameter Import area, click File and select a file to import.

    YAML and JSON files are supported. You can preview the API content to be imported on the Import API page.

  7. (Optional) Configure global settings for the APIs to be imported.

    You can configure the global settings for the APIs, such as frontend and backend requests, or modify other parameters of the APIs.

  8. Click Import Now to import the APIs.

    Imported APIs must be manually published so that they become available for users to access.

Follow-Up Operations

Publish the imported API in an environment so that it can be called by users.