Make single requests with loop to avoid timeouts

Describe the problem/error/question

I’d like to create a CSV of all customers, no matter to which employee they belong. Some employees have many customers and this creates a timeout on the API side. So I would like to make single requests on each employee, show all the customers belonging to this employee and put them into a CSV file. If succeeded I want to loop through these requests as many times as employees exist.

What is the error message (if any)?

It doesn’t work as expected. How can I iterate through the list of ids of employees to make a single API call for each?

Please share your workflow

Share the output returned by the last node

In my case it should loop 45 times and pick the next and next id, but it’s running only once.

Information on your n8n setup

  • n8n version: 1.20.0
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Ubuntu 22.04

Hi @mokkin, I assume the list of customers is coming from the “get all employees” node in your example workflow, with the Item Lists node splitting out the results? So in other words, following your Item Lists node you have a list of multiple n8n items and want your workflow to process only one of these items at a time?

If so, you’d need to place the Loop Over Items node immediately after the Item Lists node, and then execute the remaining nodes inside your loop. Here’s a quick example workflow demonstrating the idea with a dummy API using n8n 1.21.1 (on older n8n versions you’d simply need to use the “Item Lists” node instead of “Split Out”):

This will process one item at a time, and you can even see the progress during manual executions:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.