Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGabriel E
8,916 PointsPractice with AJAX and APIs help please!
I'm working on a weather project, and this is the api I need to use: https://openweathermap.org/current#geo
I'm not exactly sure how to get started even after reviewing the Flickr project. Will I need a getJSON function? Any help would be very beneficial! (If you could not tell me straight out what to do, as I kind of want to figure it out; just a strong hint. :) ) Thanks,
~ Gabriel
2 Answers
Kevin Korte
28,149 PointsHi Gabriel,
I will try to help, I've done something similar, I built this: http://weather.titanhomesllc.com which checks our local weather every few minutes and sends out a text message to our field guys if wind is suppose to be at or above 10mph, as long as it hasn't sent an alert in the last 6 hours, or it's not between 10pm and 6am, cause we're all asleep.
So just looking, your first hint is you'll need to send a post request to the api's endpoint, with whatever parameters it needs, and it will return to you a JSON object, that you'll have to parse, and do whatever you need/want with that.
If you want to look at the source code for my wind app, feel free to dig through the source code here: https://github.com/kevinkorte/weather for clues.
Ioannis Leontiadis
9,828 PointsHello Gabriel,
working with APIs requires a strong understanding of the HTTP protocol and the WWW in general.
Personally, I would recommend that you examine those topics in depth first and then moving into how to use JavaScript for your purposes.
Before focusing on you application itself consider these two courses as prerequistics:
Of course, you will need to dive deeper but these will help you with a basic understanding of what exactly you want to build and how it will function. So, when the right questions come up you will know you are in a good track!
Hope that helped!
Gabriel E
8,916 PointsThanks Loannis, I will check those out!
Gabriel E
8,916 PointsGabriel E
8,916 PointsHey Thanks Kevin! This really helped, and I'll look more thoroughly at the source code for help. Thanks again!
~ Gabriel
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsYou bet, let me know if you have any other questions