Is there a way to get a list of all variables and request/response objects used within a given policy in the proxy from within a Javascript?

Not applicable
 
2 3 1,223
3 REPLIES 3

Former Community Member
Not applicable

Hi @VG you can use the context variable to get to the variables inside request / response objects. Additionally check out the variables reference for a list of variables that you can access from within the JavaScript policy.

@ Prithpal Bhogill, thanks for the response. I am looking for a way to get all variable names; I understand I can get a value of a variable on context by explicitly giving the name of the variable. What if I don't have the variable name and I want to get a list of all variable names in the proxy and may be use it in a JavaScript/message logging policy within post client flow for logging? How can I do that without adding additional policies within the mainstream flows? Using management API, I am able to get list of policies and resource files within a proxy and get their contents; but, I am looking for something like context.getVariables() or context.getVariableNames(), which I understand it doesn't exist. Is there an alternate way?

Not applicable

@VG

We donot have a single global variable / policy that will list down all the variables set/get in a flow.

On work around that I can think of is to define a "global flow" variable and keep "appending" the new variables that you are using throughout the flow. makes sense ?