API Gateway 10.15 | Getting Started with API Gateway | Rate limit your APIs | Configuring Rate Limit for an API
 
Configuring Rate Limit for an API
In this example, let us see how to enforce rate limit as 10 for the API, Petstore. That is, the policy does not allow more that ten invocations to the API.
*To configure rate limit
1. Click APIs in the title navigation bar.
A list of available APIs appears.
2. Click Create API.
3. Select Import from URL.
4. Provide Petstore in the Name field.
5. Provide the URL, https://petstore.swagger.io/v2/swagger.json.
6. Click Create.
The Petstore API is created and the API details screen displays.
7. Click Edit.
8. Click Policies tab.
9. Click Traffic Monitoring from the Policy Catalog section and click Traffic optimization.
The policy is added. By default, the values Total Request Count and Greater than are selected in the Rule Name and Operator fields respectively.
enforce policy
10. Provide 5 in the Value field.
When the number of invocations go beyond five, the policy is considered violated.
11. Select Consumer-specific throttling and type .*, and select Each consumer.
This is to specify that the configured invocation limit must apply to each consumer application individually.
12. Select API Gateway under Destinations.
The policy violation alerts are displayed in the API analytics page.
13. Provide 1 in the Alert Interval field and select Minutes in the Unit field.
14. Select Every Time in the Alert Frequency field to log a event every time the API is invoked beyond the specified limit.
15. Provide Number of invocations reached the maximum limit. Please try later in the Alert message field.
policy configuration
16. Click Save.
The policy is enforced to the Petstore API. When the number of invocations go beyond 10, the policy violation event is displayed in the API analytics page.
Next Steps
Now that you have applied rate limit to an API, you must
*Check whether the policy applied to the Petstore API works as expected. For details on how to test the API, see Testing a REST API