# API workflow on list of API connector objects

**URL:** <https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097>\
**Category:** Database\
**Created:** [August 12, 2020, 11:29pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097 "2020-08-12T23:29:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 12, 2020, 11:29pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/1 "2020-08-12T23:29:46Z")

</div>

I am using an api connector to get data from a third party. The data that is returned contains a list. I can save the response into the DB no problem. I can access values out of it no problem.

What seems to be the challenge is “iterating” over the list. What i’m trying to do is basically Extract/Transform/Load the list into a new data type in bubble (which is a new custom list). I have accomplished this by using the Schedule Workflow on list. as @keith mentions in this [post](http://forum.bubble.io/t/how-to-create-several-items-from-a-json-list-of-items/46243).

what is frustrating is that I cannot pass a single element of the list as a `parameter` to my endpoint. Instead I have to pass in every property of the list element. So basically I have to extract the values I want individually and then pass them into my endpoint. This becomes like 24 parameters on my endpoint. I would rather pass the single element from the list.

My Question Is there anyway to simply pass an API connector data type into an endpoint, so that I don’t have to break it into all of it’s primative values that I want to extract from it multiple times. When I get it from the API ----\> passing it into my API workflow -----\> saving it into my datatype in database.

I would take any advice for a simpler way to iterate over a list from an API connector response. Mutate / filter that list. And then save it into the database as a subset / reduction of the original.

For now the scheduled API workflow on list + backend workflow (endpoint) with 24 parameters works. Just tedious passing around 20+ primatives, instead of 1 object in the list.

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [August 12, 2020, 11:33pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/2 "2020-08-12T23:33:51Z")

</div>

Does your data called in API are “Data” or “Action” ? This is an important thing because if you set “Data” you will be able to select this as list in List to run on and Type.

Also, this will be available to save it as a type in DB (are your saving the json actually as text?)

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 12, 2020, 11:40pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/3 "2020-08-12T23:40:28Z")

</div>

Thank you for quick reply!

I have it as an action because I trigger the api call on a button press, however I also tried it as data to see if I could select it as a endpoint `parameter` type. It seems to me the only values available as an endpoint `parameter` are primatives (number, text, yes/no) and custom database types (User, Events, etc …).

Side note . The response from the 3rd party API isn’t itself a list, however one of it’s properties is a list.

Example JSON Data)

```auto
{
    name: "test",
    age: 25,
    friends: [
        { name: "bob", age: 22},
        { name: "joe", age: 24}
    ]
}

```

imagine a single `friend` from the list above having 20+ properties. And I want to filter those friends and only save a few values from them.

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [August 13, 2020, 12:25am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/4 "2020-08-13T00:25:04Z")

</div>

If you set as data,  
You can trigger “Make change to a thing” or “Create a new thing” and use the Get Data from API into a field set the the Type of the API call. This way, you will be able to Run the Workflow on Alist from the type of the API.

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [August 13, 2020, 3:23am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/5 "2020-08-13T03:23:52Z")

</div>

Welcome to one of my favorite topics in Bubble…

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/6/2/62a535049e1fa1442dcca2feef66ce6f22d37a98.jpeg)

Indeed, @parker1, arrays (of _objects_) returned by the API connector are super-problematic. Which is why I’ve dubbed this, **“The API Ghetto Problem”**.

The array returned in this way is given a Bubble data type, tantalizingly called a, “`List of [something]`” (a “`list of friends`” in your example). But no _scalar_ data type called `friend` is created.

And so, in Bubble, your obvious array of JavaScript objects (an array of `friend`s) is just… a big blob of data.

And this blob, while Bubble understands that it is an array of `something` we can never quite get to a single `something`. A `something` is forever beyond our reach as there is no Bubble data type created for the `something`.

And yet, paradoxically, our app knows about a fucking LIST of `something`.

(Please note: The above description is the _net effect_ of this problem. There is no reason for this problem to exist except that the Bubble _team_ is seemingly incapable of grasping why this is a problem. I’ve explained it in many different ways, many different times, and they _just don’t get it_. It’s almost like Bubble is a low code platform created by a team that is itself… not that comfortable with computer science. Which I think is the problem here. BUT PERHAPS I DIGRESS…)

Anyway, though you can’t get an `API_something` from this `List_of_API_somethings` (what you desire to do @parker1 is simply to pass each `API_something` to a recursive workflow or to a workflow-on-a-list), you can (frustratingly) STILL ACCESS the _fields_ of that `API_something`. It’s like there’s a phantom `something` (and, in fact, the problem is that there _IS_ a phantom `something`, even though no there is no definition for the `something`).

**So, as you’ve discovered, rather than passing a something to your workflow, you must destructure the something into its component primitive data type parts.**

At least you can still do this, right?

That is, using your case as an example:

`List of API friends :item *n* :name`

Will in fact return the value stored in the “name” field for the (entirely virtual mind you) `friend` stored at index _n_. [Even though `List of API friends :item n` resolves to… well, not what we want.]

(Thank the Bubble gods for small mercies, I guess.)

So you have to just suck it up and design your API workflow you want to accept a `something` (a friend) to instead accept the _individual fields of `friend`_ as primitives.

I could go on and on about why Bubble does not fix this. (The first response would be, “Well, where would we stop?” Which is a good question. Because of course a friend could have a field on it that is itself another list of objects and then, should Bubble create a data type for _those_ objects? This is a reasonable objection, but the fact is that something like 80%+ of use cases would be solved by going just 1 level down. And something like 99.9% of cases would be solved by going 2 levels down.

[At three levels down (a list of objects returned by an API has field(s) on it that are lists of objects that themselves have fields of objects on them) this gets ridiculous and at that point, there is likely a DIFFERENT API call we can make. Simply put, well-designed RESTful API’s don’t return vastly nested arrays of objects so the first objection is just dumb on closer examination.)]

But anyway, just try and explain this to the Bubble crew. 🤷‍♂️

![image](https://us1.discourse-cdn.com/bubble/original/3X/e/a/ea95b4f5a99d4ee60e4b6109245a670290a99f47.jpeg)

Note that all we are asking for above is for the “data type” (object representation) of a scalar component of this list to be created. I won’t continue about the phallacy that to create and store individual objects of this new type would consume massive amounts of compute. (Which is what the Bubble team would have us believe.)

(In case you can’t tell, I’m entirely unconvinced that it would take more than 2X the CPU power to store this “blob” as it would take to store individual, properly-defined Bubble objects, without requiring us to resort to Bubble’s quite-costly recursion mechanisms. But I will save that discussion for another time. Just let it be known that the value Bubble puts on server compute is several orders out-of-whack with what we expect today. And there may be good reasons for this, but those good reasons don’t change the fact that the Bubble value equation is pretty warped. BUT AGAIN, I DIGRESS.)

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 3:48am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/6 "2020-08-13T03:48:56Z")

</div>

Oh man! Thank you so much for making me feel sane! I’ve searched google and a lot of these forums for this. Your one response, I mentioned above, is the only one that seemed to answer my question. However, I wasn’t sure of a how so I went with “destructuring the primitive fields” as parameters to my backend…

It’s pretty sad that this is a limitation! when you have an object with LOTS of fields it’s a nightmare.

It gets better. I went with `Scheduled workflow on list` thinking this would work. It does however I found another fun “bubble” issue. on race conditions having the workflow modify a single list IE `add to that list` I would consistently get inconsistent results XD. Thus, recursive workflows allowing me to feel confident that only 1 “thread” will be touching my list at a time… Because sleeps (interval) never make me feel like it’s a real fix.

SO, now I’m not only having to destructure my object of 25 fields to pass into the recursive endpoint to start the recursion. I ALSO have to do it again to pass it to itself for the recursion. Quite frustrating…

Thanks again,  
Parker

Ps. enjoyed the memes. I’m sure i’ll talk to you more about detailed issues of this platform. I feel like we will be comrades in sorrow. I will say, I do like the platform more than I hate it. And listshifter is 🔥

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [August 13, 2020, 3:55am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/7 "2020-08-13T03:55:14Z")

</div>

Note that my project (if I have one) is to fix these issues as best I can. I’m working on a server-side port of my PROCESS List action from List Shifter, which addresses some of the issues here (though only by making it easier to deal with parallel lists of values-that-should-be-fields).

If you’re into making Bubble more performant, powerful, and truly array-oriented, you’ll appreciate my “List Shifter” plugin and “List Popper and Friends SSAs” plugin.

Just search here for those and you’ll find these open up a world of possibilities (or at least ease certain annoyances…).

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 4:01am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/8 "2020-08-13T04:01:54Z")

</div>

Noted! i’ve already played around with list shifter a decent bit and I like it, and the list popper I thought was interesting, but for me i’m just going to recursively count down `list:count` until it’s \<= 0.

Love the idea of helping server side. LMK if I could help. I’ve been developing Node.js/Express and javascript for quite a while now. Chose bubble for easy / speed, sometimes I wonder if it was the right one XD.

you got any extra documentation / advice for JS in bubble? the JS toolbox has been really awesome, but the freaking undocumented `get_object_from_id` and `get_object_from_ids` discovery was huge for me. The bubble --\> javascript --\> bubble is kinda painful even with these tools. I don’t always want to build a plugin for simple 1 off tasks.

You seem like someone that would know if there are any pointers / hidden api documentation (like `get_object_from_id`.

Cheers

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [August 13, 2020, 4:13am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/9 "2020-08-13T04:13:24Z")

</div>

Yeah, the problem with Run JavaScript is that all it does is throw a string (of our code) to eval().

This is often sufficient.

But sometimes, we want to actually get an OBJECT (custom data type/Thing) from a list of objects. We can only properly do this inside of a plugin.

So you might have noticed that List Shifter’s PROCESS List action has an eval(x) step you can select. THIS eval step preserves certain inside-of-plugin variables, such as “the\_list” (the array we are currently iterating over), the various “Result of Step” values (as “rs1”, “rs2” etc.) and one doing that makes it possible (and FASTER) to do certain types of operations (that don’t rely on the “trick” of JavaScript type coercion).

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 4:40am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/10 "2020-08-13T04:40:04Z")

</div>

I honestly thought I knew before I knew… I’ve switched to recursive workflow… everything is fine, except, how do I initially destructure? the `Schedule API workflow on list` allows me to access 1 member of the list `This Val's thing`. But since recursive workflow doesn’t use `on list` I don’t have any way to destructure it… How do you start the recursive workflow?

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 4:42am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/11 "2020-08-13T04:42:06Z")

</div>

Now I really wish your list shifter tools worked on `backend` workflows…

My solution for each destructured primative on recursive workflow…

`Result of step1 APIs reports: first items trades: item # Result of step1 APIs reports: first items trades: count's <theDesructuredPrimative>` and I pass in the `:count`as `Recursive counter… I have to do that for every single field… 😭 …

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [August 13, 2020, 5:04am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/12 "2020-08-13T05:04:31Z")

</div>

I honestly don’t understand why my suggestion doesn’t work for you  
Instead of using an action, you use Data (or you can clone the call and change it to data).  
You will be able to Run the On your Friends list. And each frieds, you will have access to name, age …) Without the need to specify them all in the Schedule WF on a list

And you don’t need to create or make a change to a thing to Create the list to run on, just use the Get Data from API in the Data source for the Scheduled list action.

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 5:11am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/13 "2020-08-13T05:11:48Z")

</div>

@Jici I’m not sure I 100% understand your answer. It’s possible it does solve my problem.

As far as I can tell. I cannot set the Backend API Workflows `parameter` type to anything regarding API anything. data or action. I can only set to primitives and database custom types.

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [August 13, 2020, 5:17am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/14 "2020-08-13T05:17:21Z")

</div>

You can do this (I think). Just pass the list of broken things to your workflow-on-a-list. In each step (iteration) reference the current workflow’s thing’s fields. (I think…)

Or, in a recursive workflow, do the same. (But use list popper to reduce the list one-by-one.)

See: [List Popper and Friends: New SSA Plugin for Your Backend Workflow (API Workflow) Needs](http://forum.bubble.io/t/list-popper-and-friends-new-ssa-plugin-for-your-backend-workflow-api-workflow-needs/75594)

Or maybe not… but I think you can do that?

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 5:23am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/15 "2020-08-13T05:23:09Z")

</div>

@keith I had to move away from `workflow-on-a-list` because it was causing race conditions. So I moved to recursive. The problem I still don’t get is how do I pass the list `list popper` to the recursive call to begin the recursion? that list is of `API Connector` Ghetto type, So to start recursion I pass in all primatives for first element in the list. Then, in the `recursive` workflow, how would I access the list? All I was able to send was the primatives which do not include the list of `API Connector` Type.

List Popper doesn’t really help me if I can’t get access to the list inside the recursion. Here is another example to explain problem:

this data is return from api `Step1` on backend workflow:

```auto
{
  "store": {
    "book": [ 
      {
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      }, {
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      }, {
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      }, {
         "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  }
}

```

Now lets say I want to save this data in the database as `ExpensiveBook` (this is all example not practical or generic data type) .

`ExpensiveBook` custom data type has 3 properties on it. `price`, `category`, `isbn`.

So I have as `Step2` in my backend workflow I schedule an `API workflow (recursive)` to “iterate” over that list and create a new `ExpensiveBook` and add it to relevent `Stores` list of `ExpensiveBook`.

The problem is, that to initially call the `API workflow(recursive)`, I have to be able to send it either:

- using List Popper) the list so I can pop an item and then send the next call a shorter list
- or send it the list and an index that I decrement each time I call the recursive endpoint

Either way I don’t understand how i’m supposed to send the list because it isn’t yet mapped to a datatype inside of my database.

I’m sorry if i’m not explaining this well. LMK if there is anyway I can make this more clear. I cannot share the editor due to NDA stuff. However, I could potentially whip up an example demonstrating this even more obviously (idk if this is possible on hobby tier). I also would be willing to screen share privately.

---

<div class="post-metadata">

**Author:** ![parker1](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@parker1](https://forum.bubble.io/u/parker1)\
**Post date:** [August 13, 2020, 7:44am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/16 "2020-08-13T07:44:47Z")

</div>

Man recursive API calls seem REAL slow. I made one simply calling itself and nothing more. I “looped” I tested 5 times, 50 times, and 500 times. It seems that 5 times takes longer per loop cycle. But I seem to max out around 7-8 per second.

“Looping” / “recursioning” (lol) 500 times takes ~60 seconds. Seems pretty slow to be doing nothing, but looping. My best guess is 100 ms latency rescheduling itself.

---

<div class="post-metadata">

**Author:** ![thomas.plessis](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@thomas.plessis](https://forum.bubble.io/u/thomas.plessis)\
**Post date:** [September 8, 2021, 12:17pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/17 "2021-09-08T12:17:13Z")

</div>

Hi there!

I’m in the same trouble as @parker1 : The problem I still don’t get is how do I pass the list from my API Call to the recursive call to begin the recursion? ( `API Connector` Ghetto type)

Any idea on this ?  
Regards,

---

<div class="post-metadata">

**Author:** ![PasqualeJS](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/pasqualejs/32/155236_2.png) [@PasqualeJS](https://forum.bubble.io/u/PasqualeJS)\
**Post date:** [July 24, 2022, 8:17pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/18 "2022-07-24T20:17:21Z")

</div>

Hello - any updates on how to resolve this issue? I’m trying to import a list of followers on twitter to database objects - running into an issue with working with the data from the API connector and backend workflows. Any suggestions bubble lords @parker1 @keith ?

---

<div class="post-metadata">

**Author:** ![deeploop](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@deeploop](https://forum.bubble.io/u/deeploop)\
**Post date:** [February 11, 2023, 4:14pm UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/19 "2023-02-11T16:14:18Z")

</div>

Just replying to say “still a problem, fellow users I feel your pain, Bubble please sort this out” 🙂

---

<div class="post-metadata">

**Author:** ![dan34](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dan34](https://forum.bubble.io/u/dan34)\
**Post date:** [February 12, 2024, 4:56am UTC](https://forum.bubble.io/t/api-workflow-on-list-of-api-connector-objects/106097/21 "2024-02-12T04:56:43Z")

</div>

Is this still an issue as of 2024? I have the same issue and can’t find a resolution.
