Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to retrieve the variable for condition

Hi,

I have defined a variable in a javascript, but while getting that variable in the next policy and comparing it, it is giving wrong result.

I have set a variable named extractvar in java script which is the first policy in my apiproxy. the next policy is validate apikey which has to be run/skipped w.r.t. this variable "extractvar".

But in trace when check, I can see two variable with the same name, but the second one is with a curly bracket at the end.

extractvar

extractvar}

And the validate apikey policy is checking the second variable and giving a wrong result.

condition in proxy--

<Step>

<Name>VerifyAPIKey</Name>

<Condition>{extractvar}=0</Condition>

</Step>

tracing result---

expression (apikeyvalue} equals 0)

expressionResult false

Can someone tell me why this second variable is coming.

Solved Solved
0 7 538
1 ACCEPTED SOLUTION

Hi @krushna.padhee.ap,

The variable need not be enclosed with braces {variable_name} in <Condition> Tag while defining the step.

The following should work. Hope this helps, thank you!

<Step>
<Name>VerifyAPIKey</Name>
<Condition>extractvar = 0</Condition>
</Step>

View solution in original post

7 REPLIES 7