Hello,
Newbie here, developing first proxy running into challenges in using response from ServiceCallout. Really appreciate any guidance you can provide here.
API1 : For example, Returns {"city":"London"} as response.
ServiceCallOut :
(a) is created to call API1,retrieve response (city value), proceed to get other information.
(b) "calloutResponse" is the response name of my serviceCallOut.
After serviceCallout is made to API1, trying extract city using extract variables policy using below snippet.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="EV_From_SC_MockTarget"> <DisplayName>EV_From_SC_MockTarget</DisplayName> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <JSONPayload> <Variable name="IP_city"> <JSONPath>$.calloutResponse.content.city</JSONPath> <!--<JSONPath>$.calloutResponse.content</JSONPath> --> </Variable> </JSONPayload> <Source>calloutResponse</Source> </ExtractVariables>
Behavior : Looks like no values getting assigned to IP_city variable in subsequent parts of the proxy. Rather getting empty value , like listed below. "IP_city": "",
Questions : Is above right way to trying to extract response from serviceCallout ?. Please note that i referred https://docs.apigee.com/api-platform/reference/policies/service-callout-policy, unable to use calloutResponse.content as listed.
Thank you
Answer by Mj Patel · Jul 27, 2020 at 01:16 PM
Turns out that , i just need to below snippet. Just "$.city" is good enough ($.calloutResponse.content.city is unnecessary)
Issue is resolved now, able to proceed ...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="EV_From_SC_MockTarget"> <DisplayName>EV_From_SC_MockTarget</DisplayName> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <JSONPayload> <Variable name="IP_city"> <!--<JSONPath>$.calloutResponse.content.city</JSONPath> --> <JSONPath>$.city</JSONPath> </Variable> </JSONPayload> <Source>calloutResponse</Source> </ExtractVariables>
Is there a timeout setting for the ServiceCallout policy in Apigee Edge? 2 Answers
servicecallout.{policy-name}.target.url returns null 1 Answer
Routerule in ServiceCallout 1 Answer
Is it possible to pass all incoming headers in requst via Service Callout ? 1 Answer
APIGEETOOL Error Uploading Service Callout Policy with causes a "beans.OtherValidationError" 1 Answer