Skip to main content
Skip table of contents

Configuring Rule

Contents

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

  1. Click the Down 
    arrow
  2. Click the New statement option.


    Figure 3: Navigating to add new statement

  3. Click the Edit Statement 

    button. Edit the rule by changing the properties present in the dialog box. 

    Each property in the dialog box is explained in the table after the steps.


    Figure 3: "Add new statement" option to add more rules

  4. Click OK and then click the Save button on top of the screen to apply the changes.



    The Preview option helps in cross-verifying whether or not the rule is defined as intended.

PropertyDescription
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.

Example

 api.quota.weight, client.ip, proxy.request.method

Operator

Choose the operator from the options below to form a condition:

  • Equals
  • Not Equals
  • Like
  • Not Like
  • One of
  • Not one of
ValueProvide 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.

  1. Click the Down 
    arrow in the Update Rule section
  2. Click any one of the following:
    1. add conjunction
    2. or conjunction



  3. Follow the steps in the Adding a statement section.

    Click the Edit

    button to edit the statements added.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.