how to get failed policy name in java script. I need to set and get that via java script,i m trying X-apigee.fault-policy to fetch but gett

@Dinohow to logged failed policy name ?I need to set and get that via javascript, i m trying

X-apigee.fault-policy to fetch but getting null.

i have tried to fetch via policy-name in javascript.

0 3 124
3 REPLIES 3

Not applicable

I checked error message doesn't have policy name.

can you elaborate more ?? any idea how to use X-Apigee.fault-policy

Not applicable

I did try all lot of options but didn't get anything matching the requirement.

Then I used the below method and got. Add javascript to fault rule.

Inside javascript check, if any policy is failed. if that you get true then set the policy in a variable.

ex:

 
if(context.getVariable("oauthV2.Verify-API-Key-1.failed") == true)
context.setVariable("Policy failed", "Verify-API-Key-1");
else if(context.getVariable("oauthV2.Verify-API-Key-2.failed") == true)
context.setVariable("Policy failed", "Verify-API-Key-2");

....