apigeecallout

In Apigee, how can I access callout response in javascript policy


I created a service callout (eg: myCallout) which returns its response in a variable (eg: myCalloutResponse). How can I access the body of the callout in a javascript policy? I tried context.getVariable("myCallout.myCalloutResponse") and a few others but couldn't get this to work. Thanks


Solution

  • context.getVariable("myCalloutResponse.content") should give you the payload. Take a look at other variables available on response object - to extract the data you need.