[ANSWERED] Retrieving live data from website
-
Hello, I'm fairly new to Isadora, but am working on a project where I need to retrieve live chart data from a website. One of the charts needs to be the live price of gold. Afterwards I will be linking this data to a volume control for some audio. I can't quite figure out how to get the data for the gold price into Isadora. Does anyone have any ideas?
Thanks!
-
Hi @pellemolde,
Arguably, the best method for collecting live data, as you describe, is through access to an API server. There are some free public-access data servers with accessible APIs. A good one to explore is the World Bank as it publishes accessible information freely from global sources. You will find APIs for gold prices, but many require a subscription and usage license - free data is often limited by the number of requests you make for updates. This request frequency can challenge your idea of 'live' data. An appropriate API can also be used to access historical gold price data.
I have a demonstration project that pulls live data from the World Bank API and uses the dataset to display countries and their capital cities on a 3D globe. The globe uses the Longitude and Latitude data from the current accessed update data set to display where the country and city are located on the world globe. It is a base for adding other live data sets, an example might be current population or pandemic cases etc.
Feel free to unpack the Isadora v3.2.6 or v4.1.3 project file and ask any questions. download .zip

-
Thank you very much @bonemap! I've opened your project and it makes a lot of sense what to do next but I have stumbled into another problem. I have found a free API on gold price which has given me a URL and an acces token. I have tried to use the "Get/post URL text" actor but i can't figure out where to paste the acces token. The website gives med the picture under but I don't know where to put it. Thanks!
-
I was unable to get access using the authorization key in your image post. I did, however get access to https://metalpriceapi.com/docu... easily. I assume from reading about the 'x-access-token' of the goldapi.io data server it can't be used through the method available in Isadora.
Best Wishes
Russell
-
Okay but how would I go about implementing the website you have linked in isadora?:)
-
Hi @pellemolde,
The website link I sent through provides a ‘quickstart’ suggestion that provides a url:
https://api.metalpriceapi.com/v1/latest?api_key=[API_KEY]
Once you have registered for the free subscription and received the api key you will be able to complete the url. Copy the api key you receive into the url where it has the place holder [API_KEY].
In your Isadora Scene Editor, place a ‘Get URL Text’ actor module. Paste the url address from metalpriceapi.com into the ‘url’ input. Initiate the 'get' request by clicking the 'go' trigger input of the 'Get URL Text' actor module.

If the request is successful you will get a stream of data in JSON format. To extract the data you want use the JSON Parser actor module in a cascade until the specific data arrives at an output. At this point you can then route the data to activate the other elements in the Scene Editor.
You will notice in the screen shot here that the data is identified via a 3-4 letter symbol ie. AUD, DOGE, ETH. These are the id for exchange rates for Autralian Dollar, Doge Coin and Ethereum. If you look at the URL we have entered into the 'Get URL Text' - you will notice that it has the word 'latest' in the URL and then in the received JSON data the selector word 'rates' near the beginning of the data stream. I have copied the selector id name 'rates' into the JSON Parser actor module to isolate the data associated with that selector title. The next JSON Parser has identified 328 elements and these become the selector names on the input side of the JSON Parser actor module, these are the individual data points each identified by an acronym or symbol - I have chosen just three of the available selector names to access their individual data.
Go back to the metalpriceapi website and you will find guides and other URL request options - I think I saw mention of a gold price URL there.
You will have to spend time to understand the acronyms and symbols used in the data stream to identify the information that you want to use.
To get a clearer idea of what data you are working with you can copy the entire data stream from the Get URL Text actor module and past it into a Comment actor module to expose it and visually find the selector element names/symbols and other id information. Below is a partial screen grab of the data streams from metalpriceapi copied into Comment actor modules. The column on the left is from a request URL:
https://api.metalpriceapi.com/v1/symbols?api_key=[API_KEY]
and the column on the right is from a request URL:
https://api.metalpriceapi.com/v1/latest?api_key=[API_KEY]

-
@bonemap
thank you I Will try that -
I have tried to figure it out but when I use this method I just get this message "User did not supply an access key or supplied an invalid access key. Please sign up for a FREE API Key at metalpriceapi.com"?
-
Sorry to hear you are having difficulty getting a successful data stream. I am going to assume you have indeed signed up for the Metalpriceapi.com subscription. When I signed up the access URL was preconfigured in the notification process and required copying and pasting into the ‘Get URL text’ actor module. BUT the URL success is sensitive to additional spaces, gaps and invisible characters in the address string. The following screen grabs demonstrate how unseen gaps and spaces may need to be deleted to 'tighten up' the URL address before use after copying from the Metalpriceapi.com website.
1. Below is a screen grab of the metalpriceapi.com dashboard that provides my api_key. The grey box outlined in red is preconfigured with my api_key in the dashboard so I can directly copy the address string here.

2. BUT when cut and paste it also includes spaces and gaps and hidden elements that appear to make the copied text unsuccessful.

3. It will work if you clean up the address by deleting any spaces including extra tab or return spaces at the end of the address string.

-
What do you mean by the notification process?
-
It worked!!! Thank you very much!
-
Hopefully the previous steps assist in getting you a successful request from metalpriceapi.com?