Forum Academy Marketplace Showcase Pricing Features

Get live market data - How to handle dynamic property in JSON in GET API Call response

Hello Everyone!

Have been struggling to find a solution to this problem.

We are trying to get the Last traded price from Zerodha (India’s Robinhood) for individual instruments being sent in through the parameter. But the way the API is configured it sends in a nested array for that instrument (screenshot below will help). Now given this instrument name is passed on run time and hence dynamic - we aren’t able to setup the API response to get the data.

API documentation:

Here, NSE:INFY, BSE:SENSEX, NSE:NIFTY 50 are the instruments, and we are trying to get the last_price.

On initializing the call in bubble API connector, this is what we get
image
The issue is since “NSE:INFY” is dynamic, hence if we send in any other parameter except NSE:INFY it doesn’t work.

Anyway to solve this problem? Thanks

In case you are using the API connection as a Data (as opposed to Action) and getting the results of the call in an element - it will only call it once when the element is rendered.

Instead, it might make more sense to use the API connection as an Action, have a repeating workflow (Do every 5 seconds) where you can call this API, get the results, save the results either to the DB or to the states of an element and then display it.

Cheers,
Ranjit | Blur Apps

We checked with setting it action as well. But we aren’t getting any response from the API apart from the success message.

Detailing out further.
When we send NSE:INFY as the symbol, the response we get is:

{
“status”: “success”,
“data.NSE:INFY.instrument_token”: 408065,
“data.NSE:INFY.last_price”: 1741.9
}

and, when we send NSE:RELIANCE, the response is:

{
“status”: “success”,
“data.NSE:RELIANCE.instrument_token”: 409025,
“data.NSE:RELIANCE.last_price”: 2241.9
}

How do we configure bubble API connector to map to <>instrument_token rather than NSE:INFY.instrument_token?

It looks like Bubble should be able to map to “data” as a list.

But it can’t becuse of the crap (but sadly all too common) JSON structure.

I have a video on this.