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 trialpeter keves
6,854 Pointswhy is API ?
I have noticed teacher had mention this word quite often so far but not sure what it means
2 Answers
Ryan Ruscett
23,309 PointsHello,
An API is an Application Programming Interface. I like this....
Think about opening a program. Logging into the program and performing actions. This is pretty typical. You log into email to send and receive emails. You open up itunes and download a song.
Well, this is all done through a User Interface, or GUI, Graphical User Interface. You click buttons on the screen and actions are performed. Well an API does the exact same thing. Except it's via code.
An API let's me interact with an applications code to perform tasks, instead of using a GUI. Why is this important?
Say everyday for the next year. I want you to log into program. I want you to put a check mark next to the first 300 requests that came in that day. How boring and redundant huh...
Well with an API, I can write code that logs me in, finds the first 300 requests and check marks them. I can schedule this task to run everyday. That's it. The code never messes up, it never changes and performs the task, everyday without me having to waste my time doing it.
Not all programs have API's. Itunes my example above. Doesn't have an API. They don't want people interacting with their program behind the scenes. Makes sense. What if I wrote a script to buy 10000 songs a day under your account. Before they could even catch it, you would be broke and stuck with a tons of songs you didn't like. Also, allowing access to an API with credit card information is exchanged can be somewhat of a security risk. So not everything has an API. But a lot of stuff does lol.
Does this help you understand an API better?
Anthony Albertorio
22,624 PointsGreat answer.
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsHey Ryan...
That was very well written! I knew what an API was, but your explanation gave me an even clearer explanation.
Thank-you! :)
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsI love your answer :D
Good job!
Jassim Alhatem
20,883 PointsJassim Alhatem
20,883 Pointsthank you for the answer g.