How to add a default step in a flow if fails condition on other steps within the flow

I have a flow that gets executed for all GET calls using the "request.verb="GET"" condition.

Then I am using the following steps to enforce quota policies based on security.token

Step 1 has the condition: (request.header.SecurityToken = "aaaa" OR request.header.SecurityToken = "bbbb") and enforce a quota for these 2 securityTokens

Step 2 has the reverse condition: (request.header.SecurityToken != "aaaa" AND request.header.SecurityToken != "bbbb") and enforces a default Quota.

Is there a way to have step 2 execute without the need for explicity stating the reverse of the condition in step 1?

In essence, I want Step 2 to execute if step 1's condition fails.

,

I have a quota policy in place for GET calls using a flow with the 'request.verb="GET"' condition.

Then I have 2 steps to enforce different quotas based on securityToken

1: has a condition of (request.header.SecurityToken = "aaaa" OR request.header.SecurityToken = "bbbb") and enforces a specific quota policy for these security tokens

2: has condition of (request.header.SecurityToken != "aaaa" AND request.header.SecurityToken != "bbbb") and enforces a default quota policy

How can I just have the second step enforce the default policy if it fails the first steps condition with out explicitly stating the reverse of the condition in step 1

0 5 348
5 REPLIES 5

rmishra
Participant V

Are you just trying to define a different quota restriction per service account(or group of service accounts)? If that is the case, then why do you need different policies? You can use one policy with dynamic attributes for Quota.

Am i misunderstanding your problem?

Yes, how would I go about setting a different quota restriction per security.token, with a default quota if token doesnt match any.

I am not sure how you define a security token (assuming it's something similar to an access token), then you could define Quota attributes at a product level/app level.

For you the app level quota definition would make sense.

This will help https://community.apigee.com/articles/14718/using-app-attributes-to-configure-policies.html

I could do it that way, but the way my APIs are currently setup (with hundreds of users already) defining it at the product/app level make less sense than my approach. all I'm asking for is a default step in my flow if the conditions on other steps fail.

Ok.

One option could be to create an additional step and use your original step condition to set an additional context variable called "enforcedQuota"

You can use this new variable as the step condition to skip the second quota policy if the first one has executed.

There are many ways to do it.