What is an API and What good is it?
Did you anytime hear these questions?
What is an API?
Why it is required?
How to make it?
People have googled, few were satisfied and others came out perplexed. So why not we also try!
We searched for the same on Google again and enlisted some definitions from top 10 results available across the web. We will also add our own spices to explore more.
Wikipedia says “An application programming interface (API) specifies how some software components should interact with each other.”
Howstuffworks.com says “An application-programming interface (API) is a set of programming instructions and standards for accessing a Web-based software application.”
One answer from stackoverflow.com, “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.”
Let’s see one real-world example so that a layman can easily understand the concept of API.
Think of two conditions, one when there is no remote control available to change the settings of TV and other is when the remote control is available.
Obviously remote control condition is much favored as only few clicks are required for any setting change. Here, remote control acts as an API where the settings of TV can be changed without directly interacting with TV knobs. While sitting on a sofa few feet away from TV, you can control your TV. Life is easy!!
Few lines for our tech persons also.
We have two applications having their own independent implementations. Now if they need to access information from each other or one way flow then they need to expose their logic but hide the implementations, so for that, they need to create API for their application. An API is nothing but an interface which has only definitions but no implementation logic exposed. Each programming language has their own syntax to do it but the idea remains the same.
What good is API?
Answer is simple use. Also, one question, did we talk anywhere about creating a proxy? J
Where we are using API?
Yo may recall, we are using Google analytics to know the daily visits, facebook API to know the number of likes, twitter API to know the tweets, and so on.
Any more questions?