Configuring rules define conditions based on which it is possible to determine whether a policy has to be executed or not at runtime.
For example, an XML to JSON policy can be applied only if the Accept Header is set as application/json.
The Add/Edit Rule button at the lower-right part of each Policy Configuration page allows the API author to add additional rules to a policy before a message is passed to a policy.
A sample snapshot of the IP Filtering Policy Configuration page is provide below.
Figure 1: A sample Policy Configuration page with the Add/Edit Rule button
Adding Rule
Click the Add/Edit Rule button to start configuring a rule.
Figure 2: Add/Edit Rule dialog box to configure rules
Adding a statement
In the Add/Edit Rule dialog box, click the Add Element button and then click the Add new statement option to add a statement to the Configure Rule section within the dialog box. This rule can be edited by changing the properties present at the bottom of the dialog box. Each property is explained in the table below.
Figure 3: "Add new statement" option to add more rules
Property | Description |
---|---|
Identifier Type | Specify the Message Part Identifier type. Specify the part of the message from where the policy needs to check and validate the condition or criteria specified. Options available are:
|
Variable Name | Select the flow variable from the list of options available in the drop-down list. |
Operator | Choose the operator from the options below to form a condition:
|
Value | Provide the value that is expected from the condition specified. |
Adding more statements
For using conditional statements using conjunctions in the rule, add the conjunction (OR/AND) that needs to be used between the statements and then add those statements.
Click the Add Element button and then click the Add Conjunction option; select AND or OR as per requirement and configure the properties again. Elements can be rearranged or nested using a drag-drop approach within the Configure Rule canvas.
Figure 4: "Add Conjunction" option to enable adding a linked condition using the 'and'/'or' operator
Preview
The Preview option enables cross verification to determine whether or not the rule is defined as intended.