Dynamic class based quota developer?

@Dino You mentioned that you had a solution for this.

The two most similar questions are:

https://community.apigee.com/questions/5309/in-a-quotareset-quota-policy-how-do-identifier-and.html

https://community.apigee.com/questions/6229/class-based-quota-per-developer.html

The use case is that I need to be able create a quota based on the developer and some additional attribute. The attribute can vary by developer, so in this case storing the attribute on the developer is the appropriate solution. Assume that my additional attribute can have > 50 different values. In this particular use case the rate limit for each attribute is the same per developer.

Dev1 backend1 = 10 per minute

Dev1 backend2 = 10

Dev2 backend1 = 20 per minute

Dev2 backend2 = 20

I list the restrictions for the Quota policy below:

1) Straight from the docs: You cannot use both the <Class> and <Identifier> elements in the same Quota policy. You are able to save the XML when you include the <Class> and <Identifier> attribute, but when you send a request it returns a 500.

2) You cannot use the countRef attribute in the <Class><Allow></Class>. The count element is required in this case.

Straight from the docs:

class Defines the name of the quota counter. none Required
count Specifies the quota limit for the counter. none Required

e.g.

<Allow>
  <Class ref="request.queryparam.time_variable">
    <Allow count="1000"/>
    <Allow count="5000"/>
  </Class>
</Allow>

I tried to use countRef just to make sure and it could not dereference the variable that I included in my countRef attribute.

I can see from the other questions that we can use a two tier approach to handle part of this scenario: one quota for the class and one quota for the developer, but what I need is for the <Class><Allow></Class> to accept the countRef attribute.

Any suggestions on handling this use case?

e.g.

<Allow>
  <Class ref="request.queryparam.time_variable">
    <Allow countRef="customvar"/>
    <Allow countRef="customvar"/>
  </Class>
</Allow>

Solved Solved
0 1 366
1 ACCEPTED SOLUTION

Hey @swilliams

From the post, I assume client_id and the backend attribute is the unique combination. Why not create a flow variable using that.. say something like {client_id}^{attribute} and use that in the Quota as the Identifier. I don't have a code available to share though

Please let me know if this worked

View solution in original post

1 REPLY 1

Hey @swilliams

From the post, I assume client_id and the backend attribute is the unique combination. Why not create a flow variable using that.. say something like {client_id}^{attribute} and use that in the Quota as the Identifier. I don't have a code available to share though

Please let me know if this worked