user56690
user56690

Reputation: 259

Not able to fetch response URL in APIGEE

Heloo I am trying to get the response url from the backend. i am able to get request url, but not able to get response URL. Any suggestions/ ideas are mush appreciated.Thanks in advance.

Upvotes: 0

Views: 389

Answers (1)

Santanu Dey
Santanu Dey

Reputation: 2978

Assuming your backend sends a redirect URL (as HTTP 302 Location Header) and the URL contains an auth code that you want to extract in the Apigee proxy-flow response path -

You can use a java script policy in the Response path of your proxy flow, like below:

url = context.getVariable("response.headers.Location");
var re = new RegExp("#.*[?&]" + "code" + "=([^&]+)(&|$)");
var code = url.match(re);
context.setVariable("authcode", code);

Upvotes: 1

Related Questions