What is an API ? with simple examples | API | Application Programming Interface

What is an API ? with simple examples | API | Application Programming Interface

If we go by the definition provided by Wikipedia, it states the following:

“In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components”.

It is correctly defined, but still the meaning is not much clear. So let’s understand it with the help of one small example.

Consider an API as a waiter in a restaurant. Suppose you have a menu of your favourite food and the kitchen is the system where your order is made. But how do you take your order till the kitchen? Correct, you call a waiter, give him/her the order, which in turns takes your order till the kitchen and then your order is made there and then finally, the waiter comes back with your delicious ordered food.

Thus, the API is very much similar to the waiter. API is the messenger that takes your order(waiter) and tells the system(kitchen) what to do (to prepare food) and in return gives back the response you asked for (waiter returns with the ordered food).

To get more clear understanding, lets shift to another example that will clear your remaining doubts too.

Have you ever visited any sites that shows an option for signing up through Facebook or Google? How do you think you are able to login and proceed ahead with the application without ever worrying how that code was written!?! It’s because of the API that has simplified all your work. So all the information being provided for Google sign up is done through the API.

But good things require precautions and some measures to remain good. So do the API’s!

Since most of the API’s are provided for free, it needs some kind of security to keep it safe from various non-productive purposes. Hence, a new concept called API key was introduced. This key can be considered as a permission that you take from the supplier, like from Google, to use their API like for signing up in your website or any other application.

There are some API’s that are free to use, but some API’s need to be bought.

So in the last, Let me ask you one question: Whenever you book a flight ticket, you go to various other websites like MakeMyTrip , GoIbIbo , Yatra, etc. You hardly ever go to specific airlines website to book a ticket. Still, you get the place at the same Air Plane service that you might have booked through their website. So ever wondered how did this happened?

Yes, Again, it’s because of the API. Gosh! You really think you could survive without this. Don’t forget to thank your superhero – the API, who manages all your queries without any complaints and returns with the appropriate result. It has made your life much simpler and easy. This superhero is great!

I hope you got the real meaning of it! No TextBook language 🙂