Thursday, January 22, 2015

#AzureAPIMgmt '<'quota calls="x" renewal-period="seconds"'>'. Does this allow x call in total per product, or x call per API inside the product?

Azure API Usage Quota Policy allows you define quota per product , per api , per method
   
The question that I have got from the client was the following:

Quota calls on the product level = x. Does this allow x call in total per product, or x call per API inside the product?

Answer: <quota calls="x" renewal-period="seconds"> allows total X amount of calls per product.

Example:

Quota per API
I have a quota setup per API.  Every 60 seconds we can call 5 times each specified APIs. If we exceeds, we get 403 Quota Exceeded
For example:
I call "Echo API" 5 times. Then I am trying to call it one more - 6th time. Failed. 403 Quota Exceeded
But I am still able to call "My Echo API" 5 times after I have called 5 times "Echo API".



Quota per Product
Now, I have modified the policy , I have put calls="5" on the product level. Every hour we can call 5 times any APIs in total per product.

For example: I call "Echo API" 3 times, then I call "My Echo API" 2 times.  Total=5. Then I am trying to call "Echo API" again. Attempt is failed. 403 Quota Exceeded


P.S.

It's worth to note that you can't set less than 3600 sec renewal-period on the Product level in case you set calls limit on the product level.

One of improvements that I want to suggest to MS - is to provide error messages for Policy editor, as well as IntelliSense.

The  only indicator now that is something wrong with the policy is the fact that I can't save it . How do you know you saved the policy? It should be grey out when it's saved.