Monday, October 5, 2020

SAP API Management - Quota Policy - Conditional Quota Count

 Scenario: You want to assign different quotas based on client application

Steps:

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


2. Modify the code as per requirement.

Code (Allow 2 calls/1 min.)

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

    <Allow>

      <Class ref="request.queryparam.client">

        <Allow class="bp" count="5"/>

        <Allow class="dev" count="2"/>

      </Class>

   </Allow>

  <Interval>1</Interval>

<Distributed>true</Distributed>

<Synchronous>true</Synchronous>

  <TimeUnit>minute</TimeUnit>

</Quota>

3. Test the API. 

URL for Business Partner: https://<host>:<port>/<path>?client=bp

URL for Dev Team: https://<host>:<port>/<path>?client=dev





No comments:

Post a Comment