How can I preload all data in a API to save into DB with single API call vs multiple?

Hi Everyone,

I have a API that I’d like to save some data locally in my apps DB to reduce calls/latency for my users but I’m looking for an API call efficient way to do it.

Right now, I am doing this via a backend workflow. The app does a search for identifiers in a table, then the workflow creates things for each item. The problem is, each column for a thing appears to be a separate call and I’d prefer to make one call to get all the data as opposed separate calls that increase my API usage(and bubble’ servers capacity).

Is there a way to do a call like once and then load it into my table vs:
Ticker = external API call…
Name = Another external API call…
Price = another call,etc…

Can you provide API doc link and what you trying to call (which endpoint)?

Hi There,

It was more of a general question, not specific to my API. I have the API setup and it’s working but when I create a thing, I have to map the fields which I believe are making API calls for each field(therfore increasing my API usage count + adding a performance hit).

For example, for each field here, I’m selecting “External API call” so 10 fields = 10 API calls. Ideally since 1 API call has all the data I need, I would populate the data with one call.

Question is important because answer will depend of what data is provided. If ticker, name and Price come from a different call, there’s nothing you can do, but if data come from one call, you can store the entire call if the API Call is configured to DATA. Just use the Data Type of the API call as a field in your thing.

If your call is configured as “Action”, you can call the Data endpoint first in action, then use Result of step 1 and select the correct data field for each of them from the initial action

1 Like

Hi There,

Yes it is a DATA type. I’m not sure I follow what you are saying - Are you saying store the entire call as a field in my DB then parse it from there?

You can try list shifter from @AliFarahat and use conditional statement for each call up to ten times.

You just Create a field of type of your Data api Call. This is an available option when you create a field, after your existing DB. You don’t need to split the field anywhere, the entire payload is store in the item and fields are there too.

Thanks, I’m trying this. I’ll let it run and see the results. Just so I’m clear, I have a DB field with the API message then refer to that field to map to columns?

Ignore typoes in field names :slight_smile:

So far, it’s saving the message but not mapping…Not sure if it take time:

jsonMessage contain the full payload. In frontend, you can use jsonMessage’s name for example to display the name (or in your screenshot, jsonMessage’s General CountryName). you don’t need to create a field for each field in your json

wow…that is really cool. Like most things with bubble. I think I was overthinking it and making it more complicated than needed. Thank you.

Is there a way to save aspects of the message? This is a awesome solution for displaying but part of my app might need fields in columns as some columns would need to be searchable(I say might in the even there is a quick solution to search within the jsonMessage directly).

In this case you may need to add another action after to update thing from Step 1 and set specific thing you need to search from the jsonMessage field data (or use advanced filter)

A bit late, but this is what I did. I did a single API call and used the results from the action:

  1. Create an API call and set it to action:

  2. Add the action to the workflow:

  3. Use the results of step 1 and fill the db fields for every item:

Hope this helps!

1 Like

worked for me! thanks!

Oh man, this is a lifesaver! I was just dealing with the same thing and had no idea there was a built-in data type for this.