Variable scopes in proxy chains

Not applicable

I have a proxy A that returns a ID # to the client. That ID is then used in a subsequent call to proxy B. I'd like to chain these together such that the call to proxy A retrieves the ID and stores it as a variable, then calls proxy B instead of returning to the client. Proxy B would use the value of the variable set in proxy A. I can't figure out from the scope and variables documentation whether a variable created in proxy A would survive the jump to proxy B.

Is this possible, or should I be sending variables from one proxy to another through some other mechanism?

0 2 867
2 REPLIES 2

Former Community Member
Not applicable

@louis nemeth I believe the scope of the variable is at the proxy level & don't believe one proxy will have access to the flow variables of another proxy. You can set it as a header on the request variable that can be accessed from the chained proxy.

@louis nemeth ,

At the end of the day, Local API Proxy is simple target end point for Apigee API Proxy whether it's called using service callout / target end point. You can just return the ID # from the API Proxy in response & In Proxy B access same using flow variables, see more here.

Response returned from Proxy A is available for consumption in Proxy B using the flow variables. It's available out of the box.

Regarding your query,

Is this possible, or should I be sending variables from one proxy to another through some other mechanism?

Yes, It's definitely possible & available out of the box. Make sure you send the variable in response content / response headers of Proxy A so that it can be consumed in Proxy B. You don't need any some other mechanism.

Keep us posted if you have any queries while implementing same.