Loop Through API Based on API Result Data

Hello,

Could someone please explain to me how i can run an API based on another API’s results?
I have API {{url}}/api/allUsers Which return List of user
[“User1”,“User2”,“User3”]

Now i want to loop through this user list and get the details of every user:
I would like to fetch the data based on user List;
{{url}}/api/uaerData/User1

Thank you,

Hello @muhammad.afzal.exter :smiley:,

Welcome to Kore Community :clap:

You may use Bot Function - scripts to implement the use-case. Let’s say from the above example, the result of the first API call - to get user data gives 3 users.

After the Service node for the API call, use a script node to fist store that data into a variable.

Now, use “Bot Functions” to upload custom script to execute the second API, ie, API to get the user data.

We will use the script node in our bot to call this function in loop for all users and update an context array object with that data. You should be able to print the information through this object.

Let us know if this helps!!

Thank you for stopping by!!

Hi Can anyone provide an example for the above method with screenshots if possible…

I am trying to achieve similar to this how should I loop bot actions based on array of user provided entities
eg: I have an array of id’s array=[1,2,3] which will store in context.entities.ids now I want to pass these id one by one to bot action of service node GET API and store the result individually.