Save API data on my Bubble data

Hi Bubbles, im working on crypto price watchlists, can someone tell me in details how do i display a price from each coin that i fetch from API and display it on my bubble data coins data ( repeating group ).

my bubble data looks like this:
(data type)Coin - (field)Price (type)number

im a newbie and i need solution for this, hope anyone can help

1 Like

In order to systematically create a list of things you need to schedule a backend workflow on a list, the list being the results of your api. Then make step one be create a new Coin, Here you can assign the appropriate fields. You should have a field in your database that is the unique identifier for each coin from your api. This way this create a new Coin can conditionally only run if do a search for a Coin with that unique identifier does not exist. The second step would be to make changes to a Coin, conditionally this would only run if a search for a Coin with that unique identifier does exist, and you will be changing the Coin that exists by updating the price or value (whichever fields tend to change).

Finally, the repeating group will just do a search for all Coins.

1 Like

Omg many thanks to you williamtisdale for the reply, can you tell me more details about:

create a list of thing: do i need to create any button to trigger the backend workflow?
im stuck with the price thing

unique id does not exist: what is the workflow for this? can tell me more details on the step?

here are my data:

The trigger for activating the workflow depends on how “up to date” you want the prices to be. You could do it on page load, a refresh button, a recurring backend workflow. Any of those would work. To be extremely accurate all the time it seems like it would have to be a Webhook pushed to you by whichever company your are getting your info from. But for this example just pick any one of the first three options.

Every coin/stock has a unique identifier, whether it be the name, ticker, symbol, whatever they call it. This needs to be saved to each coin created in your database so that when the workflow runs a second time it does not create duplicates but instead updates the price for the existing coin in your database.

You have privacy rules on your app to where I can not view it. You can go to Settings > General and then the top option for “Editor access permissions” needs to be changed from “Private App” to “Everyone can view” just for the time you want others to view the editor.

already change it, you can view it?

i want to buy personal plan, i hope you can help me to achieve this price display

you there william?

please take a look at my data and suggest me some workflows, need help im newbie

Yea, I looked and I am not sure which API call you are using to get your data. I saw two different calls that get crypto info. You just need to create a backend workflow that runs on a list and then configure the action steps like described in my first response. Also, I looked at your data types and there seems to be a lot more fields than is returned from the api.

Don’t forget that if you set yourAPI Call to DATA, You can simply just store the whole Payload in a field that is of the type of API Connector. Each time you have an API of “Data” type, Bubble create a “Thing” of that type that can be used to set a field of that type exactly like when you create another DB.

hey William, thanks for your explaination about how to store it, i already achieve it man, once the page is reload and the price is changing.

can you review my workflow on index “page load” ?
am i doing it right?

ahh i see, but i only want to pull the price from the API and im using it as ACTION, you have any suggestion on my workflow? to make it better or simpler?

You should probably make it to where you only have one api for getting price and make the {address} or id of each coin dynamic. Then you can save that ID to each coin in the database. Then you can schedule an api workflow to run on a list, the list would then be a search for all coins in your database. Then for each coin it can make the api call for price, plug in the dynamic address/id and then update the price before continuing to the next item. This will turn your 25 step page is loaded workflow into 1 step.

1 Like

Change the type to DATA. If the goal is to get data, and not make an action on the API, it should always be a DATA type, not action. In most case, consider a GET request to be DATA. POST if they are using to search on the API should also be set to DATA. All other call like POST (to create) PUT, PATCH and DELETE should be action (because this is what they are!).

But the main issue actually I can see in your settings, is the use of different API Call while you should use dynamic url parameters.

1 Like

my api call depends on each contract address, can you show me how do i call everything only in 1 api call?

here are my api provider : Moralis Admin
im using: GET erc20/{address}/price

about the schedule api workflow on a list of thing, can you explain to me in details? because i keep getting error inside the “things to run on”

if i need the price of each coin, i need to input each contract address to get the api

can you show me the step to stored each api data called into my each coin field? im afraid if i save it as a data and i cannot put it into my bubble data field because im using repeating group

You will first need to fix the multiple to single call.
Basically, in url, you just need to replace dynamic part using [] like erc20/[address]/price
and uncheck Private box for this parameters

Switch the call to a DATA one and in your Price DB, add a new field of the type from API Connector

what is the value?
like this?

You need to replace the 0x0… By a key like address. The value will be what you have in the key actually.
Same for bsc.