Setting a quota on a product, that enforces same limit on all keys.

Not applicable

I would like to be able to set a quota on a product, that then enforces that quota on each key assigned to that product. I know that I can add a custom attribute to each Developer-App to set the limit, but this particular product is utilized by a large number of Developer-Apps, and each of those Developer-Apps has access to several products across our organization.

Managing each of these custom attributes on what could be 20-50 Developer apps will be a nightmare.

Is there a way to set a limit of say, 10 tps on a product which then allows every application with access to that product to hit 10 tps ?

Currently setting a quota on a product, means that all Developer-Apps accessing that product, share that 10 tps quota.

Solved Solved
0 2 499
1 ACCEPTED SOLUTION

Hi @Bryan Kahler welcome to Apigee Community!

One way you can achieve what you want to do is to set the <Identifier> element in the quota policy to point to a variable.

You would use a policy, for example a javascript callout might be appropriate here, to create a composite string of the product and the developer app and then pass that variable into your quota policy as your Identifier ref.

You also need to get the quota limit defined on your product and pass that to the quota policy via another variable.

More info on the quota policy is available here.

If this has helped answer your question, please click the accept link. Alternatively, let us know if there is more info you need on this topic.

View solution in original post

2 REPLIES 2

Hi @Bryan Kahler welcome to Apigee Community!

One way you can achieve what you want to do is to set the <Identifier> element in the quota policy to point to a variable.

You would use a policy, for example a javascript callout might be appropriate here, to create a composite string of the product and the developer app and then pass that variable into your quota policy as your Identifier ref.

You also need to get the quota limit defined on your product and pass that to the quota policy via another variable.

More info on the quota policy is available here.

If this has helped answer your question, please click the accept link. Alternatively, let us know if there is more info you need on this topic.

Hi @Bryan Kahler You simply add an <Identifier> element into your Quota policy to make it work.

As you may already know, the Quota defined in the Product is enforced by attaching a Quota policy. Your quota policy might look like this -

<?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>
    <Identifier ref="verifyapikey.verify-api-key.client_id"/>
</Quota>

Here the assumption is that your Verify API Key policy name is "verify-api-key". This policy will reference the Quota limits from the product and enforce them individually on all Developers Apps.

i.e. If Quota is configured as 10 per min in Product, each app will get to make 10 calls in min.