How to extract a policy variable and use in later step

Hi,

I have a needed where I need to extract the policy variables such as apigee.developer.emai, apigee.developer.id (specifically from VerifyAPIKey policy) and use later to conditionally block some of the requests based on the variable values from the policy.

I am not sure if the scope of the variable set as part of policy and whether I can able to access later as part of another flow ? if yes, do i need to apigee.<variable name> or request.<variable name> or something else.

Thanks in advance for the response.

Solved Solved
1 4 269
1 ACCEPTED SOLUTION

Hi @Sujit Tripathy

Once you execute VeifyAPIKey policy and apigee.developer.id value is populated, you can use that flow variable from that point on wards in your exection.

you can put following line of code to invoke policy conditionally.Condition won't work if you are using single quote when checking the value.

<Condition> (apigee.developer.id  = "yourdeveloperidalue")</Condition>

Regards

Jayesh

View solution in original post

4 REPLIES 4

Hi @Sujit Tripathy

Once you execute VeifyAPIKey policy and apigee.developer.id value is populated, you can use that flow variable from that point on wards in your exection.

you can put following line of code to invoke policy conditionally.Condition won't work if you are using single quote when checking the value.

<Condition> (apigee.developer.id  = "yourdeveloperidalue")</Condition>

Regards

Jayesh

Hi @Sujit Tripathy

As far as I know there in no out of box policy which you can use which will let you do that.Based on use case you can you can design your solution using apigee's existing capabilities. For example you can introduce Key Value Map(KVM) entry which holds your switch value. you can set kvm to true or false. In proxy execution you can read KVM value in flow variable. Use your existing condition in conjunction with KVM switch value. That way you can control the execution based on KVM switch value. See if that approach works for what you are trying to achieve.

Regards

Jayesh


I think this is a great solution, however please note the ExpiryTimeInSecs element of the KVM policy, and that caching is applied in case you change the value in the KVM but don't see this reflected instantly.

https://docs.apigee.com/api-platform/reference/policies/key-value-map-operations-policy#ExpiryTimeIn...