I would like to release an API that operates in this way:
Every 10 requests to this API is 1 count against the user's quota on their rate plan.
Is there a way I can set this up? I may be missing it in the docs.
Thank you!
@Jonathan Harahush In normal Quota policy there is an attribute called "MessageWeight". Messageweight multiplied by calls you get the final Quota. So you might be able to set MessageWeight as 0.1. I have never tried MW with fraction, so not 100% sure.
I guess the question was about monetization impl
Do you mind to share the use-case? Why you can't increase quota *X for such scenario?
Assuming this is for certain set of users, you can add quota limit as Custom attributes as part of the Dev app configuration (or app developer, product, KVM, Vault as well). You can refer to Dynamic Quota for more info and videos here
Use this in Quota policy (below example is Custom attribute on the dev app)
<Quota name="CheckQuota"> <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval> <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit> <Allow count="200" countRef="verifyapikey.verify-api-key.apiproduct.developer.quota.limit"/> </Quota>
In this case you can set the limit = rate plan * 10 and this gets picked at runtime
This can be done with a Rate Card with Custom Attribute. The textbook example for this feature would be "charging by the kilobyte"; for example:
During each call, a numeric value is assigned in the proxy, and then captured by the Transaction Recording Policy as a custom attribute. That value is the number of kilobytes, which can have a fractional portion: e.g. 8, 0.7, 6.543
That's a flexible custom attribute rate card, with multiple bands, including a final unlimited band; and with variable usage. But it can be simpler: fewer bands or a single flat rate; the price can be zero. And the numeric value assigned in the proxy can be fixed.
If the custom attribute is always 0.1, you will need ten of those to be counted as one. A single band with an upper limit acts like a quota.
The cumulative usage is stored with a fixed number of decimal places, so you cannot accurately do something like 3-for-1 or 7-for-1, though.