Python Dates and Times in Python Let's Build a Timed Quiz App The Question Classes & the Plan

peter keves
peter keves
6,854 Points

why is API ?

I have noticed teacher had mention this word quite often so far but not sure what it means

2 Answers

Ryan Ruscett
Ryan Ruscett
23,298 Points

Hello,

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?

Jason Anders
Jason Anders
Treehouse Moderator 145,081 Points

Hey Ryan...

That was very well written! I knew what an API was, but your explanation gave me an even clearer explanation.

Thank-you! :)

I love your answer :D

:heart: Good job! :heart:

Jassim Al-Hatem
Jassim Al-Hatem
11,126 Points

thank you for the answer g.