0

Is there a field type or a way to have a field which retrieves information from the web, like a stock price from google finance?

If would like to have a form were a field name "stock price" would be updated from google finance for instance, base on stock name field. 

13 replies

null
    • janeefielding
    • 2 yrs ago
    • Reported - view

    IF you figured out how to do this, I would be most interested in some guidance.  Thanks

    • Ludotlse
    • 2 yrs ago
    • Reported - view

    Unfortunately, no.

    • Sean
    • 2 yrs ago
    • Reported - view

    You can use the http() function to get that information from any available API. I don't know if it can be executed by a trigger, but it can certainly be executed in a button and then you can copy the info to a field.

    • janeefielding
    • 2 yrs ago
    • Reported - view

    Thank you Sean.  I tried this and got an error from yahoo finance..Based on their examples.. can you see what I am doing wrong (I assume I want a get as I want to get information from their API.

    let urladdr := "https://yfapi.net/v6/finance/quote?region=US&lang=en&symbols=";
    let urlsymbols := "AAPL";
    let urlauth := " accept: application/json X-API-KEY: {myet}"

    let urlstr := url (urladdr+urlsymbols+urlauth);

    let response := http ("GET",urlstr);

    alert (text(response));

    • Sean
    • 2 yrs ago
    • Reported - view

    Hi Jane,

    I don't want to set up an acount so I really can't test this. I did click "Try it out" and "Execute", but ended up with "Error: response status is 403" and the Response body was 

    {

    "message": "Forbidden"

    }

     

    You can try something like this using Ninox and you would just enter your API key...

     

    http("GET", "https://yfapi.net/v6/finance/quote?region=US&lang=en&symbols=AAPL", {
    'x-api-key': 'YOUR-PERSONAL-API-KEY'
    }, null)

     

    I'm not aware of the "url()" function you are using. I have use urlEncode() in Ninox.

    • Sean
    • 2 yrs ago
    • Reported - view

    I just watched the tutorial video and it looks like the URL needs to be "https://rest.yahoofinanceapi.com/v6/finance/quote?region=US&lang=en&symbols=AAPL"

    • janeefielding
    • 2 yrs ago
    • Reported - view

    Thanks Sean.. still no luck making it work.  I feel like I am missing something fundamental.  Thanks for trying!

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Have you put your code between the 'do as server...............end'? This could be the reason, in my case anyways. Also the 'Content-Type': "application/json" used in the code?

    I'm not an API-expert but worth the try....

    Steven

    • janeefielding
    • 2 yrs ago
    • Reported - view

    thank you for your input.. I appreciate any insight...

    I have tried do as server.. here is my latest kick at the can... I have tried a bunch of combinations of double and single quotes... and commas and I am at my wits end...

     

    let response := do as server
    http("GET", url("https://stock-data-yahoo-finance-alternative.p.rapidapi.com/v8/finance/spark?symbols=AAPL%2CAMZN {x-rapidapi-host: yahoofinance.p.rapidapi.com, x-rapidapi-key: mykey}"));
    end;

     

    the response I get now and under may different configurations of quotes and commas is invalid API key but it is a valid API key soI am very confused.

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Hi Jane,

    Can you try this version and see what it gives? Just a thought....

    do as server
    let response := http("GET", "https://stock-data-yahoo-finance-alternative.p.rapidapi.com/v8/finance/spark?symbols=AAPL%2CAMZN", {
                           'Content-Type': "application/json",         <<<<<<<<This line could be optional, not sure if needed
                           'x-rapidapi-host': "yahoofinance.p.rapidapi.com",
                           'x-rapidapi-key': mykey})
    end;

    alert(text(response))

    Steven

    • janeefielding
    • 2 yrs ago
    • Reported - view

    Hey Steven, the format "do as server let response :=" doesn't seem to work.. must use " let response := do as server.". if I use your sample and change that I still get the same invalid API key.. maybe its rapidapi and I not getting along.

    thanks again for your ideas. I'll try anything.

    j

    • janeefielding
    • 2 yrs ago
    • Reported - view

    Well, I took a break and then went back to it.  I was originally trying to run in Console to see if it would work... put the following code in a button and works like a charm.. (not sure the URL statement is necessary).  I had to extract response via a bunch of substrings but I get the data.  Thanks for all your help.

     

    do as server
    let symbol := “AAPL”;
    let period := "1mo";
    let url := "https://yfapi.net/v8/finance/chart/" + symbol + "?comparisons=" + symbol + "&range=" + period + "&region=US&interval=1d&lang=en&events=Open";
    let response := http("GET", url, {
    'Content-Type': "application/json",
    'x-api-key': "MYKEY"
    }, null);
    if response.error then
    alert("error")
    end
    end

Content aside

  • 2 yrs agoLast active
  • 13Replies
  • 1054Views