Creating a Plug-in

APIG provides flexible extension capabilities for APIs through plug-ins.

Important

Plug-in parameters will be stored as plaintext. To prevent information leakage, do not contain sensitive information in these parameters.

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. In the navigation pane, choose Dedicated Gateways. Then click Access Console in the upper right corner of a dedicated gateway.

  3. In the navigation pane, choose API Publishing > Plug-ins.

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

    • Request throttling: Limits the number of times that an API can be called within a specific time period. Parameter-based, basic, and excluded throttling is supported.

    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.

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