Based on ids in response from the target endpoint make other multiple calls and prepare a final response.

Hi I am new to apigee, I have a requirement where the response from one endpoint is used to make multiple other calls with same url but different path suffixes. At end we need to prepare a final response object using above responses.

for example,

If response from "https://mocktarget.apigee.net/json" is some list of ids and sub ids.

loop the list >

I have to make a call (say if id='12132') 'https://mocktarget.apigee.net/json/12132'

and on more call (say if sub-id='123')'https://mocktarget.apigee.net/json/12132/lov/123'

At end we need to prepare a final response object based on reponses.

How to approach on above requirement.

0 4 130
4 REPLIES 4

Not applicable

Looping is a bad practice in Apigee. You should avoid looping. My approach for this would be

1. make a service callout to https://mocktarget.apigee.net/json

2. collect the response and use a javascript to make the async call for ids and sub ids. remember javascript max execution is 200ms.

3. then add all the responses and frame as your final response.

So I should use no target! then use service call out ?

yes, that works.

Just to let you know guys you can increase javascript execution time on the policy defautl is 200.