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 trial
What is an API?
I am not clear on what an API is.
I don't recollect it being covered in previous videos, and I have researched it outside of Treehouse to little avail.
My understanding of it would be that and API is a way to communicate with a server? But how? Through what type of code?
Can anybody offer a layman's explanation?
Thank you in advance.
Happy Holidays, an API is an application programming interface which allows people who have access usually to an API key to get certain data. For instance, if I wanted live weather updates, I might use an online platform with an API to get live weather updates. I would write some code and that would display my results.
You could also try out the Ajax Basics course on treehouse.
Thanks guys! All these answers really helped. Just to put it up here for easy access, this is the content of the link Richard Duffy recommended:
What is an API?
An application programming interface (API) is a particular set of rules ('code') and specifications that software programs can follow to communicate with each other. It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.
How is it used?
The same way any set of rules are used.
When and where is it used?
Depends upon realm and API, naturally. Consider these:
Richard Nash24,862 Points
An API is a gateway to somebody else's data. To get a twitter feed or Facebook post or a SoundCloud song, etc... you use an API. This is different from embedding using something like an iFrame, which is basically a little website within another website. Using an API gives you more control over the data you retrieve and how you present it.
Hope that helps clarify things a little more for you :-)
Kevin Korte28,148 Points
Richard covered it. It allows you to get data from other services. For instance if you wanted to display the weather on your website. As far as the language, that's up to you.
Here are some code samples in multiple languages from a weather API
Jeremy Castanza12,081 Points