Question

Action that returns multiple items - how to loop through them

  • 12 July 2021
  • 2 replies
  • 2319 views

Userlevel 1

Hello,
I’m having troubles to set up integration for an App that has API. The goal is users to be able to create Zaps with that integration that run once a day, week or month. So the first step from the Zap should be “Scheduler from Zapier”, right? The next step from the Zap should be an action from integration and this action makes a GET request to the app’s API and returns multiple items(persons) like this:
{
  "1": {
    "id": "1932",
    "first_name": "Test1",
    "last_name": "Test1",
    "email": "test1@gmail.com",
    "birthday": "1987-08-04",

},

"2": {
    "id": "1933",
    "first_name": "Test2",
    "last_name": "Test2",
    "email": "test2@gmail.com",
    "birthday": "1987-09-05",

}

}

What I can not figure out is How to make the Zap to  loop through elements of this object and run the rest of Actions for each of them. I tried to make an action of the  integration to return an array of objects but run into an error saying that an action should return an object instead of an array. I read about looping through line items, but cant find anything about looping trough objects.

It seems to me like I miss something. What should I do? I have control over the integration and the API.
Thank you


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

2 replies

Userlevel 7
Badge +14

Hi @d.parvanova 

Check out the Looping app: https://zapier.com/apps/looping/integrations

Perhaps post screenshots of how your Zap steps are currently configured.

Might be good to include a link to the API documentation you are referencing.

Userlevel 1

Hello, Thanks for your answer.
I did a lot of test Zaps with “Looping by Zapier” and I am pretty sure I had a Zap that worked (first step Scheduler, second step Action to get items from API, third step Formatter / Line Itemizer; fourth step Looping / Loop from line items). But it suddenly stopped working a few days ago with error “ Required field "Values to Loop" (loop_values) is missing.”. So I am back to almost the beginning trying to figure out how to loop. 

I have a Zap that loops fine but it’s first step is a Webhooc and as I see Zapier makes line items from  what it receives from Webhook. So it makes it easy to have a loop. (first attachment)

So it looks like the question is how to make line items from result of an Action. I tried to add Code step after Action. My intention was to “itemize” the input, but it seems I can not get like inputData the output from action. The second screenshot shows the result from testing the action and the third screenshot shows what can I select for inputData in Code. As you see there is no possibility to select all that was returned from action.

Thank you for helping.

 

 

A moderator edited the images in this post to remove personal information. Please remember that the Zapier Community is a public forum, do not include any personally identifiable information in your posts.