Scenario: You want to activate quota policy from a particular datetime.
Steps:
1. Add an instance of Quota in Preflow for incoming request.
2. Modify the code as per requirement.
Code (Allow 2 calls/min from specific datetime)
<Quota async="false" continueOnError="false" enabled="true" type="calendar" xmlns="http://www.sap.com/apimgmt">
<Allow count="2"/>
<Interval>1</Interval>
<Distributed>true</Distributed>
<StartTime>2020-10-5 7:38:00</StartTime>
# TimeZone is GMT
<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 after the specified time.
No comments:
Post a Comment