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 Monetization Limit Check Policy Configuration page is provided 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
To add a statement, perform the following actions in the Update Rule dialog box
- Click the Down arrow
- Click the New statement option.
Figure 3: Navigating to add new statement Click the Edit Statement button. Edit the rule by changing the properties present in the dialog box.
Figure 3: "Add new statement" option to add more rulesClick OK and then click the Save button on top of the screen to apply the changes.
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 Down arrow in the Update Rule section
- Click any one of the following:
- add conjunction
- or conjunction
Follow the steps in the Adding a statement section.