Can we hit Java Callout twice for a single API call to merge the 2 response as a final response

I am exposing a proxy using Java Callout,

Proxy : https://hostname:port/patron/345?query1=q1&query2=q2

Expecting internally it should call the below APIs

API 1: https://hostname:port/patron/345?query1=q1

API 2: https://hostname:port/patron/345/enquiry?query1=q1&query2=q2

The final response should be combination of API 1 response and API 2 response.

Is this possible to have the above result scenario in APIGEE.

Can anyone help to provide any solution or suggestion.

0 3 256
3 REPLIES 3

Im not sure the relevance of your Java callout but you can reach a single target by setting it as the target of your API Proxy and use service callouts for other targets.

You could then use an AssignMessage policy or a JavaScript policy to then combine the responses.

With that said your proxy and API address are almost all the same, except your second API has an enquiry resource. Is this correct? Do you expect your proxy to call itself? Or is hostname a different hostname for API1/2?

Sorry its my mistake,

Request URL: https://hostname:port/patron/345?query1=q1&query2=q2

a Java callout is a kind of policy that you can use within Apigee Edge to perform some custom work, something that can't be done by one of the 30+ builtin policies.

I think what you want to do is merge the responses to two requests.

And , yes, you can do that with Apigee Edge. As you can imagine, this kind of question has been asked here before.

Here is a page of search results that might help! [search]