Set Variable
Use the Set Variable policy to set the value of a runtime variable, or to clear a runtime variable, or to add a header variable.
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 set-variable.
About
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 |
Action | Yes | Defines what action to apply on a runtime variable. Choose one of the following values:
The default value is Set. |
string |
Set, Add, or Clear | Yes | Specifies the name of the variable that you want to set , add or clear, depending on the selected Action. | string |
Type | Yes | Select the data type of the variable. Choose one of the following values:
If you are using the DataPower API Gateway then, for all values other than any, the value is validated against the specified data type. |
string |
Value | Yes* | Allocates this value to the specified variable. Can be a literal value, or another
variable. * Value is required only when For example, to set a named
variable of As another example, to
set a named variable to the value of the Content-Type header in a request, you can
specify the Value entry as
If the selected value of the
Type field is boolean, select the
Value check box to indicated a value of Note: You
can only set single string elements. Values are retrieved as strings and therefore you cannot clone
a complete nodeset.
|
string |