API data retrieval example?
tatiang
Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
Does anyone have an example of a project that pulls API data from a site?
I saw these threads already:
But I was hoping someone had actually set up a file that does this...
I want to be able to pull PurpleAir.com air quality data into my app.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
Do they have an api you can reach? Or are you expecting to screen scrap the data from Purpleair.com?
@adriangomez Purpleair.com has an API. I can also use Airnow.com's API which is better documented but less reliable in terms of actual values.
I'm really just looking for an example project that uses any API. Specifically via JSON data but it doesn't have to be that... it's just what I'm familiar with.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I just finished integrating some games with Firebase, via Glitch. So server running on Glitch, data going to and from a database with Firebase. Not exactly what you're after, but if you could get the data from purpleair.com to a Firebase database it would definitely be possible to get it into a game.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
You can look at my two videos. Somewhere in the middle of second part of the video I connect to amplitude for analytics. The first video and the first part of the second are connecting to Gamesparks. All the connection request are simple rest:
https://www.youtube.com/playlist?list=PLzlEhF55FpRI-P6EUE1pqEc9vJZ0TefBQ
@tatiang if you could help me out by sending me the exact API request you want to make (assuming you want to use the public data and not private data) and what data you want to pull from it (there's a lot of data in the purple API), that would save me some time.
I could then throw together a sample on glitch to show the basics.
Here's an example: https://www.purpleair.com/json?key=U2U1PIDHBAD5JU0E&show=38825
The data I want is "v1" within Stats. I don't exactly speak JSON but I think that's roughly: results-->(1st object)-->Stats-->v1. If not that then I'd settle for results-->(1st object)-->PM2_5Value. And a bonus would be the following data from results-->(1st object):
ID
Label
temp_f
Thanks!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User