Use the if construct to apply a section of the assembly when a condition is fulfilled.
|DataPower® Gateway (v5 compatible)||1.0.0|
|DataPower API Gateway, functionality provided by switch|
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 if.
An if construct provides a way to branch an API's assembly when a specified condition is
fulfilled. Each if construct contains a section of the assembly that is only executed when the
script within the construct returns a
When using the assemble view's property sheet, use the Condition field to
write your condition that returns
If you want one or more policies or constructs to be executed when the condition of the if construct is fulfilled, drag the new policy or construct onto one of the dashed boxes that are displayed within the if construct. Constructs and policies included in the if construct are part of the case that is executed when the condition of the if construct is returned as true.
For information about the OpenAPI implementation of an if construct, see if.
In the Condition field, use the form
to reference your variables, where context is the context that you want to
reference, location is the location of the variable within that context, and
variable is the name of the variable.
Construct property details
You can configure a construct's properties in the property sheet in the assemble view.
|Title||No||A custom title for your construct when it is displayed in the canvas. If a title is not
|Description||No||A description of your construct, it is not displayed on the canvas.|
|Condition||Yes||Use GatewayScript to provide conditions. A list of context variables that you can use to generate conditions can be found in API Connect context variables.|