Limit total Quota Counter for multiple AppKeys

Hi

We have a scenario where we have multiple API Products with some quota.

Now we have created multiple Dev Apps each having it's own API Key.

Our requirement is to maintain a limit on total number of calls made from these multiple API Keys. It means we need to sum the counter of quota across multiple apps and them limit them using Policy.

Is there a way to achieve this use case ?

Thanks

1 5 262
5 REPLIES 5

Hi Gaurav,

You can use custom attributes on the Developer or Developer Application objects in Apigee to store your per-app or per-developer quota and rate limits. When you validate an API key or access token in the Apigee proxy these attributes will be copied into the current request context so that they can be referenced from the Quota or SpikeArrest policy.

You can also use the Quota or custom attributes on the API Product, but then those attributes will apply to any developer application that is assigned that product, not only to specific developer apps.

For more info on creating developer apps using Apigee's management API, see http://apigee.com/docs/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_ema....

Hi @Tejaswini U

I already understand the things you mentioned.

But my query is below

Suppose there is one developer attached in screenshot which has 5 Dev Apps each having it's own API Key with some API Products having quota.

We want to maintain the count (quota) for each Dev App which can be achieved using Quota Policy for each API Key

In addition to above, we also want to get the total count of quota (say number of requests per day) for all the 5 Dev Apps for this developer and then set the limit (say 10000 requests per day for all 5 Dev Apps).

developer-apigee.jpg

Please consider the following steps to achieve different qouta's for different developer apps.

  1. Create two API Products-> Go to Publish, Products, and create two API's products and set the appropriate Quota there.
  2. Create two or more developers. Also at Publish -> Developers
  3. Create the two Developer Apps also at Publish, and ensure that Developer A gets API Product A, and so on. The combination of a Developer with a API PRODUCTS (aka Developer App) creates an API Key. This way the qouta can be enforced by the provided apikey.
  4. On the API proxy, create a Quota policy, but also check on the API key as this latter policy provides info for the Quota policy. An example is provided below:

The Quota policy then checks for the APIKEy policy Developer App, and validates the qouta:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<VerifyAPIKey async="false" continueOnError="false" enabled="true" name="verify-api-key">
<DisplayName>Verify API Key</DisplayName>
<APIKey ref="request.header.apikey"/>
</VerifyAPIKey>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="impose-quota">
    <DisplayName>Impose Quota</DisplayName>
    <Allow countRef="verifyapikey.verify-api-key.apiproduct.developer.quota.limit" count="2000"/>
    <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval>
    <Distributed>true</Distributed>
    <Synchronous>true</Synchronous>
    <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">month</TimeUnit> 

</Quota>

Hope this code might help in that case.

Hi @GAURAV,

What I understood from your question is you want to apply individual quota per developer App and also want to add another quota on a collective basis per product.

If that is the case then you can use two different quota policies.

One for your normal per app-apikey based where individual apps will be having their own quota.

One for product level quota where quota counter will be maintained for all the apps of that corresponding product. This you can achieve by use of Identifier element and give that the reference to your product.

Hope this helps

Hi @Mohammed Zuber

What you are saying is partially correct. Here is the correct usecase

We want to apply individual quota per developer app and also we want to add another quota on a collective basis per developer or per company having multiple developers.