Software AG Products 10.7 | Using API Gateway | Usage Scenarios | Custom Policy Extension
 
Custom Policy Extension
 
How Do I Invoke an API through HTTP or HTTPS using Custom Extension?
How Do I Invoke an IS Service using a Custom Extension?
How Do I Invoke an AWS Lambda Function using Custom Extension?
How Do I Invoke an API Asynchronously through JMS/AMQP using a Custom Extension?
How Do I Define a Custom Variable?
Custom Extension Properties
Data Objects and Variables Available in API Gateway
API Gateway provides a range of out-of-the-box policies to address common API management requirements like security, transformation, validation, error processing, and so on. In addition, API Gateway provides an option to add custom extensions or custom variables.
Custom Extensions
You can add these custom extensions into API Gateway policy stages to handle a requirement that might not be handled by any of the existing policies. You can use custom extensions in conjunction with the existing policies across stages. For example, if you want to invoke a third-party API or call an external endpoint during any stage of API processing, you can add custom logic in the corresponding policy stage and use it as required.
API Gateway supports the following custom extension types:
*External endpoint
Use this custom extension when you have an external endpoint exposed, which can be configured and invoked during any stage in API processing.
For example, if a native API expects the request in a certain format and the client application sends the request in a different format, you can add a custom extension to modify the incoming request to the required format before sending it to the native API.
*webMethods IS service
Use this custom extension when you want to invoke the webMethods IS policy.
*AWS Lambda
Use this custom extension to invoke an Amazon Web Services (AWS) Lambda function and use the business logic built-in the Lambda function in any stage of API processing.
*Messaging
Use this custom extension when you want to send some data to a queue or topic during any stage in API processing and a system can read the message from the queue or topic and process it asynchronously.
Custom extensions are applicable to the REST, SOAP, and OData API types. Custom extensions are supported at all levels such as, API, Scope, Global and can be added in any or all policy enforcement stages except the transport policy and the traffic monitoring policy stages.
The figure depicts a sample workflow for custom extension support in the request and response processing stages in API Gateway.
Custom Variables
You can configure custom variables under custom extension policy. You can assign a value or a variable expression to a custom variable which can be used in other policy parameters. Custom variable also provides option to set custom field to the transactional events. To set the custom fields, you have to define customTransactionFields.FIELD_NAME custom variable. It also provides an option to configure namespaces for XPath expressions. To configure the namespaces you have to define XpathNamespaces custom variable.