Schedule API workflow - Running on every item in list

So I have an API call set up like so:

There are 200 recommendations, where each recommendation has 7 attributes (“id”, “wine_id”, “wine_name” etc)

When I schedule the API workflow:

and the actual backend workflow looks like this:

and the “create a new recos2” looks like:

it creates 1,400 records in by recos2 db, not the 200 that it is supposed to. Clearly it is thinking that the “List to run on” is 1,400 items long (7 attributes x 200 recos)

I own the API so I can make any edits to that as required. I have played around with changing the json response to look like this (I added in the square brackets around each reco):
image

But that causes this problem:
image

I’m sure there is a setup here that will work but I just can’t seem to figure it out. I’d love any help.
Thanks

The second structure you tried looks like a dead-end.

Some options with the original structure …

Thanks to @louisadekoya for the correction below!

Wishful but incorrect thinking ...

A. On the endpoint, have a single parameter of type “Recommendation API Call wine_recos”, i.e. the type is the same as defined in the API connector. Then you can
pass just one parameter, and use its fields in the workflow.

B. Same as A, but define it as a list. Then instead of Schedule on a List, use a recursive Schedule API workflow, and pass the entire list as a single parameter, use the first item, and when running it again, pass the list :from item #2 .
This is more reliable than the list scheduler, but you need to be more careful to avoid never-ending loops.

1 Like

Hi @mishav, as I discovered much to my consternation recently, you can’t actually define an endpoint parameter as an API-response data type. Only native Bubble and custom data types are possible. It has been discussed elsewhere on the forum. I’m not sure but I think it is what Keith refers to as the Ghetto API problem or words to that effect.

Hi @mishav and @louisadekoya,
Thanks for your responses but I did just figure this out.

The solution was to use the extra square brackets around every reco. This now sets up the api structure like this:

Likely I could get rid of the uppper level list (“wine_recos (list)”) and just have the “wine_recos_item 1 (list)” but this is working and I’m too lazy to change the API response again. This now makes the list to run on look like this:
image

I assume bubble’s programming makes it so that anything inside are seen as one item in the list and any {} are not. I’m not explaining it very well but essentially each of the 200 recos are now surrounded by which bubble now sees as 200 items in the list.