
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.
-
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));
-
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.
-
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.
-
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
-
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 + "®ion=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