Saving stock price data fetched via API call to Backendless DB with Codeless

Hello :slight_smile:
I’d like to fetch data from Alpha Vantage and save it to Backendless and (later) create a Dashboard of processed data on frontend.
I have the response object in Page Data, which looks like this:


and I’d like to save like Symbol ( MSFT), time stamp, indicator ID (SMA) and its value to DB, but I have problems with manipulating of nested, complex objects.
Could anyone suggest me a YT video, a docs page where such a use case is detailed?
Thank you!

Hi Vane,

Welcome to the Backendless community. Here’s an example I put together for you.

I am using the following URL for the request:

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo

The response looks like this:

Here’s a logic that shows how to retrieve the symbol and timezone and save them in the database:

Once the code runs, I get the following in the database:

Hope this helps.

Regards,
Mark

1 Like

Thank you, it looks great! :slight_smile:

Hi Mark,

when I run mine ( also printing and logging extracted data of tickerSymbol), my log shows it is undefined.
also, my code saves a record into DB, but without the data I need (tickerSymbol), so DB table only shows: objectId, ownerId, created, updated.
I use input fields of a page to set up API call query parameters and it looks like this:


In which component did you define variables: “avResponse” and “objectToSave”?
I did it in Button’s On Click event.
When I create them on page level ( On Page Enter ) as empty objects, they are not available in Button logic level.
Where do you think I go wrong?
Thank you!

You should define all the variables at the same level where the logic is. Add more print statements to log everything you can, such as avResponse_BAK, the result of Get property "2 Symbol", etc. If the data is not being saved in the database, it means it get into the object you’re saving.

1 Like

Just to inform others who might find this thread later:
the query what Mark and I made was different:
in my case tickerSymbol has a
"1: Symbol" key,
while in Mark’s query, which worked with his Codeless logic, it is:
"2. Symbol" !
So check it for yourself before copy it :slight_smile:
Thank you Mark!

Btw, this is a good example why naming json properties as “1. XXXX”, “2.BBBB” is a bad idea.

1 Like