Is there way to assign a quota to a specific ApiKey as an attribute that overrides the quota on the API Product?

Not applicable

We have an API Product that allows X request per day. Would like to override this for a given API Key to only allow Y requests per month instead. Would prefer not to have to create separate API Products for differing scenarios like this. Is there an attribute that can be added to an ApiKey to override the API Product quota?

0 2 797
2 REPLIES 2

@matthew.rinkenberger@infogroup.com @Benjamin Goldman

APIkey has custom attributes. YOu can specify the quota there and then in the quota policy make it reference the custom attribute specified in the apikey.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota">
    <DisplayName>Quota</DisplayName>
    <FaultRules/>
    <Properties/>
    <Identifier ref="developer.app.id"/>
    <Interval ref="verifyapikey.Verify-API-Key.apiproduct.developer.quota.interval"/>
    <TimeUnit ref="verifyapikey.Verify-API-Key.apiproduct.developer.quota.timeunit"/>
    <!--<Allow countRef="verifyapikey.Verify-API-Key.apiproduct.developer.quota.limit"/>-->
    <Allow countRef="verifyapikey.Verify-API-Key.developer_quota"/>
    <Distributed>false</Distributed>
    <PreciseAtSecondsLevel>false</PreciseAtSecondsLevel>
    <Synchronous>false</Synchronous>
</Quota>

This shows the quota specified as a custom attribute (developer_quota) of the developer which is then used in the quota policy .

<!--<Allow countRef="verifyapikey.Verify-API-Key.apiproduct.developer.quota.limit"/>-->

<Allow countRef="verifyapikey.Verify-API-Key.developer_quota"/>

I am refrencing all other variables from product. If you want you can define all of those as developer or apikey's custom attributes as well.

Look at this two line : The first line (commented) is which I will have by default to reference the quota from api product. The second line is my modified

i know that DEVELOPERS have custom attributes as well. You might be able to set a specific custom atrribute there and then have a conditional that overrides the value of the quota in the proxy.

i know that we do this at the product level, but im not sure ive seen it done this way. In theory it should work. someone should post an example 🙂