Updated on 2023-12-08 GMT+08:00

Importing APIs

Scenario

APIG allows you to import Swagger 2.0 APIs to existing or new API groups. Swagger is an open-source tool built based on OpenAPI specifications to design, build, record, and use REST APIs.

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

Prerequisites

  • Supplement the extended Swagger definition of the APIs to import. If the extended definition does not contain the required settings, create them on the APIG console.
  • You have sufficient API group and API quotas.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner and choose API Gateway.
  4. Choose a gateway type in the navigation pane.

    • Shared Gateway: You can create and manage APIs immediately. You will be billed based on the number of API calls.
    • Dedicated Gateways: You can create and manage APIs after purchasing a gateway. You will be billed based on the usage duration of the gateway.

  5. In the navigation pane, choose API Publishing > APIs.
  6. Click Import API.
  7. Set the parameters listed in Table 1.

    Figure 1 Importing APIs
    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 an 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 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

    If this option is selected, the extended definition items (access control and request throttling policies) of an imported API will overwrite the existing policies with the same name.

  8. 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.
    Figure 2 Parameter Import

  9. (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.

    Figure 3 Configuring global settings
    Figure 4 Modifying APIs

  10. 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.