Gateway extension guidelines - DataPower API Gateway
Before you develop your extensions to the DataPower® API Gateway, consider these guidelines.
For information on the different types of gateway, see API Connect gateway types.
Introduction
You apply an extension to a DataPower API Gateway by uploading one or more .cfg files that define the required extension behavior. These .cfg files contain DataPower API Gateway CLI commands. For details of the full set of CLI commands that are available, see the DataPower API Gateway CLI command documentation.
You package the .cfg files in a .zip file, together with any additional required files that are referenced from CLI commands; for example, a .json file that contains the OpenAPI definition for an API. The .cfg files are processed in alphanumeric order by file name.
You upload the extension .zip file to an API Connect Gateway service, and enable the extension, as described in Configuring your Gateway server extensions.
Using CLI commands in a Gateway extension
Although you can use any DataPower API Gateway CLI commands in your extension .cfg files, typically you use commands that modify API Connect objects that have previously been deployed to the DataPower API Gateway.
When API Connect objects are deployed to a DataPower API Gateway, .cfg are created on the Gateway that define the configuration of those objects. By examining those .cfg on the Gateway, you can determine the precise names of API Connect objects that you want to modify, and the current values of the properties of those objects. You can access these .cfg files by completing the following steps:
- Log in to the DataPower administrative user interface; for the Graphical Interface, select WebGUI rather than Blueprint Console.
- Switch to the DataPower application domain for API Connect if necessary.
- Under Files and Administration, click File Management.
- Expand the temporary: folder to locate the .cfg files.
The files for API Connect objects are named according to their containing provider organization and Catalog, as
follows:
20.provider-org-name_catalog-name_collection.cfg
The prefix
20
controls the position of the file in the overall processing sequence, which is in alphanumeric order by file name.CAUTION:- Do not modify these files directly in the DataPower API Gateway file system, use the gateway extension mechanism described on this page.
- Do not apply gateway extension modifications to configuration in the local:/config-sequence.cfg file.
Example 1 - change the scope of the rate limit for a Plan
api-plan myorg_sandbox_financial-services_1.0.0_basic
The
api-plan command has the following
syntax:api-plan plan_name
and creates a Plan of the
specified name, or modifies a Plan of the same name if it already exists. By using the specified
name, you can add api-plan commands in your Gateway extension
.cfg files to modify the Plan.provider-org-name_catalog-name_product-name_product-version_plan-name
where:- provider-org-name is the name of the provider organization.
- catalog-name is the name of the Catalog in that provider organization.
- product-name is the name of the Product that contains the Plan.
- product-version is the version of the Product.
- plan-name is the name of the Plan.
api-plan myorg_sandbox_financial-services_1.0.0_basic
rate-limit-scope per-client-id
exit
For
more information on configuring Plans by using DataPower API
Gateway CLI commands, see
API Plan commands.Example 2 - add a path to an API definition
top; configure terminal
api-operation bank_branches_get_operation
reset
method GET
exit
api-path bank_branches_path
reset
path "/details"
operation bank_branches_get_operation
exit
api-definition myorg_sandbox_myapi_1.0.0
path bank_branches_path
exit