You can use the same approach as I described above, except: rather than attaching quota limits to the developer app, attach quota limit information to the developer entity in Edge. Just as with the developer app, it is possible to attach custom attributes to a developer.
Then, your quota policy will do something like this:
<Quota name='Quota-1'>
<Identifier ref='developer.id' />
<Allow countRef='my_custom_quotalimit'/>
<Interval>1</Interval>
<TimeUnit>day</TimeUnit> <!-- hardcoded, just for fun -->
<Distributed>true</Distributed>
<Synchronous>false</Synchronous>
<PreciseAtSecondsLevel>false</PreciseAtSecondsLevel>
</Quota>
One key difference - we use the developer.id for the Identifier. This means the quota applies to all instances of all apps attached to that developer. (And all products, etc).
There is one additional difference here. VerifyApiKey will not automatically and implicitly retrieve the attributes for the developer, and set appropriate context variables. For attributes attached to the app, VAK does this automatically. For attributes attached to the developer, you must configure your proxy to do that explicitly.
To do so, after VerifyApiKey, insert a policy called AccessEntity, which will use the developer.id set by VerifyApiKey, to retrieve all the attributes associated to the developer. Then use ExtractVariables to get the attribute that specifies the quota limit, and the interval (if you want). Usually the interval is 1. Eg, 100,000 requests per 1 day. So it may be that you want only the 100,000 number.
ExtractVariables will set the context variable that contains the 100,000 number (or whatever it is). In the above example this is my_custom_quotalimit.
So the ordering of policies is:
- VerifyApiKey (or OAuthV2/VerifyAccessToken)
- AccessEntity - for the developer
- ExtractVariables - to get the value from the developer
- Quota
This is something I’d want to put into a shared flow so that the same logic could be re-used across all those API Proxies.