Publishing multiple items via API

Hey bubblers,

Thanks for all the help so far on this forum.
I now have a new one and the scenario is as follows:

I have a repeating group listing products from my db

I have created a custom state for the repeating group and I am adding / removing items to it by selecting / deselecting them from the repeating group.

Once all selected, I need to push them via API to a marketplace. Now, the API documentation allows uploading items 1 by 1 and I managed therefore to upload only the first item and I am struggling to understand how to get the entire list over on the marketplace.

Is there a way of creating a loop workflow that runs the API for every item in the list?

I would appreciate any ideas.

Thanks

Hey @AviationGeek :wave:

Yes, the way to do loops is easiest from the backend workflows. Those are only available on the paid plans though.

Here is a video that explains how to do it if you need it. It’s a paid video: NoCodeMinute - eLearning Hub

In a nutshell, you send it to the backend with an iteration number and loop through until the iteration is equal to the number of items.

If you are on a free plan, you can use a plugin that loops through things on the front end. One plugin example would be this one: Simple looper (workflow repeater) Plugin | Bubble

Hope that helps to point you in the right direction. :blush:

1 Like

thank you. I read more about the iteration number and made it work. I will summarize the solution below maybe it is helpful for somebody else:

Solution:
Step 1 - creating API workflow and defining parameters
Create API workflow “upload” and define 3 params:

  • List of things you want to go thru (in my case “products”)
  • Index
  • Count

Step 2 - creating API workflow list of actions

Action 1
Define first action of the API - in my case upload data via a predefined API

Action 2 - this is the looping instruction
Schedule API workflow and choose same API “upload”
Scheduled date: Any convenient date for your app. In my case “current date & time”

Define parameters:
List of things = products
Index = index+1
count=count
Only when index<count

Action 3(optional)
Send email confirming success and add whatever data is relevant to you

Step 3 - Triggering API workflow

In order to trigger the API workflow, I am using a button in my app:
When button pressed ->Schedule API workflow “upload”
Scheduled date=current date&time

Params:
Products = list of selected products
Index = 1
Count = list of selected products:count

This is the definition of list of selected products:

1 Like