Is it possible to call an internal proxy endpoint in a loop in Apigee?

Hi,

I have a requirement where I need to iterate through a list of values and call an internal proxy endpoint with each of these values. A few questions regarding this:

1. Is it possible to make a service callout to an internal endpoint in a loop?

2. If no to above, is it true that loops in apigee are only possible via a javascript policy?

3. Is it possible to call an internal endpoint within a javascript policy? Or can this only be done via a service callout?

Thanks

0 3 244
3 REPLIES 3

1. Policies can't be looped / run in a loop

2. Yes, you can do loops within custom code policies such as javascript, java callouts

3. This should be possible.

You should also consider how long do you expect a single API request to take to get processed to avoid API requests timing out. Also consider what happens if those requests you're waiting for in that loop take longer than expected or fail, etc. This approach is a good way to create a bottleneck and potential performance issues.

Another consideration is Application Integration, which better supports use cases requiring loops, multiple calls, etc.

Thanks @dknezic ,

Just expanding on 3.

Since the endpoint I'm trying to call is internal, I'm worried that I can only access it using proxy chaining and a LocalTargetConnection configuration.

This article suggests that using httpClient in a javascript policy will force us to leave Apigee edge. https://docs.apigee.com/api-platform/antipatterns/proxy-within-proxy

Since httpClient forces us to leave apigee edge, are you sure a javascript policy can still call the internal endpoint? I.e. Is it possible to make a local target connection within a javascript policy?

Thanks again

Just to confirm, when you refer to "internal endpoint", do you mean proxy chaining - one API proxy calling another API proxy or are you using Apigee X, and looking to call a service/endpoint that's not over the internet?