API data retrieval example?

tatiangtatiang 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:

This is an embed external element. It can be deleted using the delete key or the backspace key. To view the full element, press the preview button below.
This is an embed external element. It can be deleted using the delete key or the backspace key. To view the full element, press the preview button below.

Need Help in getting using Get Table from URL

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

  • adriangomezadriangomez Member, PRO Posts: 440

    Do they have an api you can reach? Or are you expecting to screen scrap the data from Purpleair.com?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited August 2020

    @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

  • ArmellineArmelline Member, PRO Posts: 5,385

    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.

  • adriangomezadriangomez Member, PRO Posts: 440

    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

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,201

    @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.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This is an embed external element. It can be deleted using the delete key or the backspace key. To view the full element, press the preview button below.

    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

Sign In or Register to comment.