Hello and welcome to School of Basics, I’m
Raghav and today we're going to learn what is an API So if you have never heard of the term API,
you might want to know what exactly is an API, if you go online and search for some
Wikipedia definition or go to a book you will find the definition of API which is technically
correct, however it is very difficult to understand from these definitions what exactly and API
is. So in this video I will make it very simple
for you and after watching this video you can confidently go and explain to anyone what
an API is. So let's get started and API stands for application
programming interface and API essentially is a component that enables
the communication between two different applications and these two different applications can be
completely different from each other for example they can be an application which is develop
missing text platform using Java and its uses oracle as it’s database, there can be another
application which is developed or one of Windows platform using C++ and it uses my server as
it’s database. Now these two applications cannot communicate
with each other directly, but with the help of API they can, so API enables communication
between two different applications. Let’s look at our examples so suppose you
go to a restaurant to order food, so let us say, you go to a restaurant and this is you
and you will order that food from the kitchen, so here is the kitchen, so you will order
the food and the kitchen will serve the food. However there is a person involved in this
communication who takes the order from you, goes to the kitchen, places your order and
then takes the food and places the food on your table towards you, in order. So this person is the waiter, so we have a
waiter here and the waiter takes your order , goes to the kitchen and from the kitchen
brings your order or your food and places it on your table. So this waiter enables the communication between
you and the kitchen and that is why the waiter acts as an API. Now you might get a question like what is
the importance of having or this person or waiter in this communication, I can also directly
go to the kitchen and place my order and take my food. Now that is true, however take this scenario
if you speak and understand English and the chef who is there in the kitchen speaks only
German and understands only German. Now in that case it will be very difficult
for you to communicate with each other and that is why this person or this API plays
a very important role in communication between applications. So now I will take you to my system and show
you a real-world example in this example I will try to book flights between 2 destinations
using some online travel application, so I will just say flights from bombay to delhi
and I will Google this and you can see I have got a lot of options and there are some travel
websites as well. I will just go to some travel website here,
so let me just go to makemytrip.com and he can see, we have a from-to destination depart
date and then the other details so I’ll say Bombay to Delhi on this particular date
and I will say search flights and you can see it has searched for the flights and it
has given me all the options. So you can see it has given me auctions from
different Airlines we have AirAsia, Vistara, Air India, Spicejet, IndiGo, Go Air and so
on. So it has actually interacted with all these
applications of different airlines and communicated between these Airlines and has given us all
the results. Now in this example we have seen that there
was an online travel service that has communicated with different Airlines or Airlines applications
and have shown results. So here let us say, here we have this online
travel app, it can be MakeMyTrip or any app and then here we have different Airlines so
let’s say we have a Vistara here, Air India, IndiGo, Jet, Go Air. So this online travel website has communicated
with all these applications of the airlines and has given you the information so here,
this communicate with this and send that response back, sends the request and response, request
response, request response and the same thing. Now what do you think about how this communication
is possible? Now one of the ways is all these airlines
or all these applications are giving access to this third party to access the database
and get information now that might not be the case because any Airlines or any application
will not allow any third party to get into the database or to see their information for
security reasons and for other obvious reasons. So that might not be the case, another case
can be all these applications or these Airlines applications are dumping all their data every
10 minutes or 15 minutes and from that particular source, this third party MakeMyTrip or any
travel application can access the data. Now that can also not be the case, because
all this happened in real-time. Let’s say you are trying to book a flight
and a flight got canceled just 5 seconds ago but the source where you are fetching the
data from is still showing as available and you are able to book a flight so there will
be a lot of chaos if that happens, so even this cannot be the case, now what happens
here is all these applications had exposed information in the form of an API, so they
have exposed some APIs that can access their information from the application and can provide
information and the third party application is getting the information through that API
so it sends a request in the form of an API that these applications understand they look
at the database and provides tender information so all this happens in a very secure format
so they need a medium and they need a format, so here these two things are important, medium
and format. So the medium can be an HTTP for example when
we talk about APIP web services HTTP is the most commonly used medium and the format can
be some common protocol like JSON or XML so this can be a common format that can be understood
by both of these applications. So let’s take an example when you talk to
your friend over the phone, the phone is the median and English language that both of you
can understand is the format the same way that APIs talk to both of these applications
and it communicates and then it enables the communication between both of these applications
so this is what API is in very very simple words and this is exactly how APIs, work I
will also have a separate session or video where I will tell you how this web services
API work, and if you have any other topic that you want me to cover in the school of
basic series, you can write them down in the comment section below and I will meet you
in the next episode of the school of basics. Thank you for watching! :)