GatewayScript
Use the gatewayscript policy to execute a specified DataPower® GatewayScript program.
Gateway support
Gateway | Policy version |
---|---|
DataPower Gateway (v5 compatible) | 1.0.0 |
DataPower API Gateway | 2.0.0 |
This topic describes how to configure the policy in the assembly user interface; for details on how to configure the policy in your OpenAPI source, see gatewayscript.
About
The gatewayscript policy gives you built-in
access to the DataPower Gateway module via variable
apim
.
Properties
The following table lists the policy properties, indicates whether a property is required, specifies the valid and default values for input, and specifies the data type of the values.
Property label | Required | Description | Data type |
---|---|---|---|
Title | No | The title of the policy. The default value is |
string |
Description | No | A description of the policy. | string |
Source | Yes | The GatewayScript source code to execute. For
example:
|
string |
Examples
The following examples show how the full OpenAPI for the policy looks in the source code.
gatewayscript:
title: writes message to DataPower log
source: console.debug('Hello World!');
Example
two:gatewayscript:
title: script written in multiple lines
source: |
var message = [ 'Hello', 'World!' ];
console.debug(message.join(' '));
For more code examples, see GatewayScript code examples and, if you are using the DataPower API Gateway, Using context variables in GatewayScript and XSLT policies with the DataPower API Gateway.
Errors
JavaScriptError
- a generic error that captures all errors that occur during the execution of the policy.