Forum Academy Marketplace Showcase Pricing Features

How to create several items from a json list of items

Hello, im using the api connector to get a list of contacts. I now want to take this list of contacts and add it to my app data. I’m currently only able to create one actual contact in my app( the first contact or last contact i get from the api response). Any help is appreciated!

Yeah, if you want to convert an array type object coming from the API Connector to separate Bubble things (like a Contact datatype in your database), you need to snag the API response and then iterate over it to unpack it into individual values that can be saved in Bubble.

This is endlessly frustrating, of course. (I call this effect “the API Ghetto” – list type

You can either do this type of iteration as an API Workflow on a list (the list in question is the list response from the API), or do it with some custom JavaScript in a page, or you could run a recursive API Workflow, now that those are allowed.

You may or may not find that the server-side options are fast enough for you.

What I wish is that one could say of such lists: “Look, Bubble, this is a list of type Some Real Type in my Database, not ‘custom response from API’.”

And then the things would actually exist in the database as objects of that type. As it is now, they DO EXIST in the database, if you save them there (as a list object blob) and so they take up storage, but they cannot be manipulated in any useful way without first iterating over them in the way I describe above. Meh.

3 Likes

Hi Keith, can I ask a related question? I want to send a list of unique IDs related to a Thing for indexing on Algolia, along with other fields from the Thing. When I use the notation thingIDs: [“thingIDsFromBubble”], though an array is created in Algolia, it just has a single value of all IDs separated by commas.

Is there a way of separating a list of values from a Bubble field into individual components of an array in a PUT request?

  • Actually I worked this out - you can use ‘join with “,”’ to achieve this. Thanks anyway :slight_smile:
1 Like