Nav

Applying a Custom Policy

To make a custom policy available to users, you add the policy to Anypoint Platform in API Manager. Users can then see and apply the custom policy listed on the Policies tab of the API version details page of an API.

Adding a Policy to Anypoint Platform

To add a policy:

  1. Go to the API Administration page, click the menu icon on the top-right, and then choose Custom policies.

    custom+policies+1

    The Custom policies page appears:

    custom+policy0

  2. Click Add custom policy.

  3. Give the policy a name and provide the files that define and configure the policy.

    custom+policy

  4. Click Add.

Using the New Policy

After you create a policy, you manage it from your custom policies page:

custom+policies+3

You can apply a policy as follows:

  1. On the API Administration page, click a version of an API.

    The API version page appears.

  2. Scroll to the bottom of the page, and click Policies.

    The list of any applied and available policies appears.

  3. Find your custom policy in the list of available policies, and click Apply.

custom+policies+4

Properties you set up in the policy template YAML file, such as description, category, required characteristics, and provided characteristics are displayed in this list. When you click Apply, a dialog based on what you defined in the YAML file appears.

Failed Policies

In Mule Runtime 3.8 and later and API Gateway Runtime 2.1 and later, when an online policy is malformed and it raises a parse exception, it’s stored under failedPolicies directory inside policies directory, waiting to be reviewed. In the next poll for policies it won’t be parsed. If you delete that policy, it is deleted from that folder too. If the folder has no policies, it is deleted.

Using Existing Policies

You can modify or combine existing policies that exist by default. You can view the XML source code, and use it in a custom policy configuration.

In an on-premises runtime installation, search for the folder examples>policies to find existing policies.