Saturday, September 12, 2020

SAP API Management - Quota Policy

 Scenario: You want to limit API calls based on time interval.

Steps:

1. Add an instance of Quota in Preflow for incoming request.


2. Modify the code as per requirement.

Code (Allow 2 calls/min)

<Quota async="false" continueOnError="false" enabled="true" xmlns="http://www.sap.com/apimgmt">

  <Allow count="2"/>

  <Interval>1</Interval>

<Distributed>true</Distributed>

<Synchronous>true</Synchronous>

  <TimeUnit>minute</TimeUnit>

</Quota>

3. Test the API. 

In this case, during 3rd call within a minute, the below response is received.



No comments:

Post a Comment