Help Center> API Gateway> User Guide> Plug-ins> Creating a Plug-in
Updated on 2022-09-26 GMT+08:00

Creating a Plug-in

API Gateway provides flexible extension capabilities for APIs through plug-ins.

Guidelines for Using Plug-ins

  • An API can be bound with only one plug-in of the same type.
  • Plug-ins are independent of APIs. A plug-in takes effect for an API only after they are bound to each other. When binding a plug-in to an API, you must specify an environment where the API has been published. The plug-in takes effect for the API only in the specified environment.
  • After you bind a plug-in to an API, unbind the plug-in from the API, or update the plug-in, you do not need to publish the API again.
  • Taking an API offline does not affect the plug-ins bound to it. The plug-ins are still bound to the API if the API is published again.
  • Plug-ins that have been bound to APIs cannot be deleted.

Creating a Plug-in

  1. Log in to the management console.
  2. Click in the upper left corner and choose API Gateway.
  3. In the navigation pane, choose Dedicated Gateways. Then click Access Console in the upper right corner of a dedicated gateway.
  4. In the navigation pane, choose API Publishing > Plug-ins.
  5. Click Create Plug-in.

    In the Create Plug-in dialog box, configure the plug-in information.

    Table 1 Plug-in configuration

    Parameter

    Description

    Plug-in Name

    Name of the plug-in you want to create. It is recommended that you enter a name based on certain naming rules to facilitate identification and search.

    Plug-in Type

    Type of the plug-in, which determines the extension capabilities of the plug-in.

    • CORS: Specifies preflight request headers and response headers and automatically creates preflight request APIs for cross-origin API access.
    • HTTP Response Headers: Enables you to customize HTTP response headers that will be displayed in an API response.

    Plug-in Content

    Content of the plug-in, which can be configured in a form or using a script.

    The plug-in content varies depending on the plug-in type:

    Description

    Description of the plug-in.

  6. Click OK.

    After creating the plug-in, bind it to the API for which the plug-in will take effect.

Binding a Plug-in to an API

  1. In the navigation pane, choose API Publishing > APIs.
  2. Click the name of the target API to go to the API details page.
  3. On the Plug-ins tab page, click Bind.
  4. In the Bind Plug-in dialog box, select an environment and plug-in type, and select the plug-in to bind.
  5. Click OK.