How to used nested for loops in Postman Flows – 🙋 Help


Hi,
I want to use a Postman Flow to automate a manual task.
The task contains the following actions:
1/ Create a Chapter (POST request)
2/ Create a subtitle for the Chapter (another POST request)

A subtitle can only be create after the creation of a chapter because the chapter id is needed to create the subtitle

The number of chapters and subtitles depends on 2 lists part of the flow.
The first list contains the chapters, the second list contains the subtitles.

Example:
Chapter 1 – SubTitle 1.1, SubTitle 1.2
Chapter 2 – SubTitle 2.1, SubTitle 2.2, SubTitle 2.3

How can I first loop on the list of chapters and for each chapter loop on the list of subtitles?
First create: Chapter 1 – SubTitle 1.1, SubTitle 1.2
Than create: Chapter 2 – SubTitle 2.1, SubTitle 2.2, SubTitle 2.3

Currently I combine 2 for loops but first all chapters are created and after that the subtitles are created.
Chapter 1 – Chapter 2 – SubTitle 1.1, SubTitle 1.2, SubTitle 2.1, SubTitle 2.2, SubTitle 2.3

Any idea how I can achieve this?



Source link

Leave a Comment