Benefits of applying automatic policies to the Application Programming Interface

The following article considers the application of Automated Policies for the API (Application Programming Interface).

Sometimes, developers need to apply a policy or the same set of policies to several application programming interfaces. That makes developers feel tired and bored when having to perform the same activity multiple times. This is where the new Anypoint Platform feature becomes useful, a feature called Automated Policies.

What is the automated policy?

Automated policies make it easy for Anypoint platform developers or administrators to apply the same set of policies to all their APIs.

This allows API owners to deploy APIs confidently and know that the environment in which they are deploying will have important policies in place, so they no longer have to insert policies into the API. manually.

Automated policy is only available for Mule 4 API using the Mulesoft Anypoint Platform.

The policy automatically supports all run-time deployment goals such as CloudHub, Runtime Cloth and Hybrid.

Step 1: Initialize the application programming interface

In the Design Center in the Anypoint Platform, creating simple RAML files can be checked by applying Automated Policy.

Step 2: Publish to Exchange

Once the API is created and tested using the Mocking service, publish the API to Exchange.

Step 3: Manage APIs in API Manager

When the API is successfully published into Exchange, go to the API Manager to manage the API. The generated API will be called and processed successfully in it.

Step 4: Configure automatic policies

In API Manager, on the left panel, is the Automated Policies section. Click it to apply different policies to your API, which will reduce the workload applied each time.

In this case, the expert is applying Client Id Enforcement (IP ID Enforcement List) and IP Blacklisting, but you can apply any number of policies from different policies. be provided.

When configuring policies automatically, at the bottom of the policy configuration page, there is a rule. This rule dictates that the set of runtime will be affected by the policy:

Applies to all supported runtimes (4.1.1 and above). All API proxies based on Mule 4.1.1 and above will be affected policy.

Applies to a specific set of runtime. You can configure a series of runtime versions to inherit policies automatically. For example, if the From input is 4.1.2 and the To value is 4.1.4, the automated policy will be applied to all APIs deployed within this scope. An API implemented on 4.1.5 will not be affected by this policy.

Step 5: Deploy API to CloudHub

In Anypoint Studio, import the newly created API from Exchange and deploy it to CloudHub.

Here, the expert has used the AUTODISCOVERY API concept. You can also use it by referring to the instructions below: Using API Autodiscovery in Anypoint Platform

Step 6: Review the automatic policies

Once the API is up and running, you need to go to the API Manager to see if the policies have been applied to the API.

In API Manager, go to the policies section and you can see the policies applied. And if you want, you can add more policies to the API by clicking the Apply new policy button.


The Automated Policy option will save time for developers. In this article, because you only use a single API, you cannot calculate the amount of time saved. However, if you handle 20 to 30 APIs and all of them need to be applied and configured with the same policy, you will feel the effectiveness of this policy. Therefore, this is an option that simplifies the work for developers recommended and appreciated by experts.


Address: 157 Nguyen Du - Hanoi - Vietnam. - Email: [email protected] Phone: 08.84654888
Copyright © 2016 - VOA. All rights reserved