Create or refresh data of repeating group using API call

Hi there,

I have read several posts about the use of external API’s but I can’t make my scenario work.

I have simple GET API configured in the Bubble API connector. This public API has a JSON array with 30 records as a response. Each record as the fields: facility_name, total_places, free_places.

I have a button called ‘Refresh data’. On click I want to call the API and create records in my database (list: Facilities) which will show up in my Repeating group that is linked to this Database list.

How should I approach this?

Note: I am still in hobby plan, because I first want to test out the capabilities of Bubble, beforing upgrading. I hope this scenario is possible? If not I do like to have some insight in way to implement it.

Thanks in advance.

Hi all,

I understand that I need a paid account for my scenario to work. Using a api workflow on a list. Can someone tell if a Personal account is sufficient?


@FJP if your API workflow is quick enough to get a response back, you could use this approach …

Alternatively, do you really need to save the result in the database? Repeating groups can display lists from API results.

Yes personal account should allow you to schedule API workflows, and a limited set of recurring workflows.

To supplement @mishav, if you need something faster than running a workflow on a list, you can load the data use the Bulk Data API. It maybe be a bit trickier to set up and I don’t know whether it’s included in hobby plan, but it’s certainly helpful once you’re larger and loading larger sets of data more regularly.

It is included. Good idea!

I think I am a step further but not there yet. My API was set to use as data. Now I changed that to use as action. On button click I trigger the API. Then I call the API Workflow passing the facilities name from the result of step 1. Now I get the message, that I need to upgrade. I wil upgrade tomorrow.

But after this I added total places parameter to the API workflow. The issue returned that it was a list of numbers instead of a number. So I changed it on the api workflow that it is a list/array.

What I don’t understand is why FacilityName isn’t seen as an list/array. Because both properties are part each of the JSON response array objects.

Thanks for the help/insight

Thanks both for the information. I will first try things out on Hobby Plan.

I am able to show the api response in a repeating group, but in the past we have had scenario’s of saving response data in the database (using other no-code platforms) or updating data based on the api response. I am looking into Bubble to decide if we want to add Bubble to our portfolio of no-code platforms. So I want to compare it witch some of our past use cases.

I have searched plugins for Bulk Data API, but I only found Bubble Data API. Is that the one to use?

Looking at my current scenario, how should I configure the api workflow or api workflow on a list regarding the following response below:

“facilityName”: “facility1”,
“time”: “2018-11-07T07:28:04.126973482Z”,
“totalPlaces”: 807,
“freePlaces”: 396,
“occupiedPlaces”: 411
“facilityName”: “facility2”,
“time”: “2018-11-07T07:28:04.126973482Z”,
“totalPlaces”: 364,
“freePlaces”: 214,
“occupiedPlaces”: 150
“facilityName”: “facility3”,
“time”: “2018-11-07T07:28:04.126973482Z”,
“totalPlaces”: 443,
“freePlaces”: 187,
“occupiedPlaces”: 256
“facilityName”: “facility4”,
“time”: “2018-11-07T07:28:04.126973482Z”,
“totalPlaces”: 139,
“freePlaces”: 92,
“occupiedPlaces”: 47

For each object in this array I want to create a record in my database table (list) “Facility” filling the properties Facility Name, Time, Total Places, Free Places, Occupied Places accordingly. I already setup a API Workflow with an Endpoint containing these properties as parameters. But how should I trigger this in button click on my page?

So far I have this limited to facility name, total places and free places:
API Worfklow

Button Workflow

I keep getting issues regards FreePlaces / TotalPlaces which are lists of numbers instead of number. I Just want to iterate over the json array and for each object saving a record with the properties stated

Thanks again! Looking forward to your reply.

I did make it work! On a Personal plan now, and a bit of logical thinking :slight_smile:

But I do have some questions:
In my opinion it is quite slow while trying this out in test mode. It take about 3/4 to 1 minute to load 33 records with only two properties in de database. Is this due to the fact that I om personal plan? Or is Bubble not that fast?

This is the same while deleting all the records on button click.

This speed sounds about normal for Create records, even with more fields. Data API Bulk create can go slightly faster, but not significantly.

It really makes you think about if and when to do a lot of creates.

Thanks. It indeed make you think what you want with data, when and how. What is the Data API Bulk exactly. Is it this option?

Yes, read the Data API sections in the Manual and Reference documentation.

1 Like