Best answer

How to execute unknown large number of API calls?

  • 21 January 2021
  • 1 reply

Suppose I am creating a ZAP for importing order to the External API. The External API is not well optimized and requires one call for creating the Order and separate call for each Order Line to attach it to the previously created Order.

If the number of Order Lines is low, say less than 10, I can execute multiple requests in a single ZAP cell with custom code and it would work just fine. However, these ZAPs have limit of 10 seconds of execution time. In case there will be Order with 1000 Order Lines, it will certainly reach the 10 seconds limit as the whole import process could take maybe a few minutes.

To solve this, I guess I need to somehow split that single ZAP that is executing all the 1000 calls to calling 1000 times another ZAP that is responsible for executing a single Order Line call.    

I know it is possible to “chain” ZAPs, i.e. trigger one ZAPs after another, but in this case I need to tigger the unknown number of ZAPS and I don’t know how to do that.

How do you suggest to solve this problem? Is it even possible to create such long-running chains of ZAPs? I understand that is resource heavy and not optimal approach, but sometimes it is the only solution.



Best answer by GetUWired 27 January 2021, 15:15

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +12

You could put a code step before that splits everything into batches(an array of objects) which will execute the next step (the one with your call) a variable number of times. 

I think @TimS explains how to do this (called forking a zap) in his article here: