Is it possible to use variables i.e. ratelimit.{policy_name}.used.count or ratelimit.{policy_name}.allowed.count in conditional flow?

Not applicable

I would like to calculate the percentage of ratelimit.{policy_name}.allowed.count and send the notification by using ServiceCallout policy when the ratelimit.{policy_name}.used.count is >= calculated value (from percentage of ratelimit.{policy_name}.allowed.count).

Currently I used for this the js but this script is executed every API call. I know that js is not recommended by Apigee because it has an impact for performance. So is it other, more optimal way to define the conditions?

1 3 207
3 REPLIES 3

yes, you could use them and also apply conditions like > or < on them,

Condition Reference: http://apigee.com/docs/api-services/reference/conditions-reference

It seems that I have to use javascript. How does this affect the performance or time handling of API call?

Hey @Dorota Krasinska

You wrote, "I know that js is not recommended by Apigee because it has an impact for performance."

I recommend that you be careful about that conclusion. Before you rule out the use of JS, test it. In my experience JS callouts work just fine at very high loads, if they are not used for big integer math (for example, RSA key verification), or long running calculations (eg, encryption).

Even so, your question is a good one. Using the ratelimit variables in Conditions is a good way to go.