Alright friends, let's now talk about something known as an API. You may have
heard of this
term many times before and you are just a little bit confused as to what it's
all about.
It can be a little bit obscure and a little bit esoteric the first time you
hear it. So let's try
to demystify what an earth this is all about. The first thing to state is that
an API is just an
acronym for an application programming interface. Okay great, class is over, we
now know everything
about APIs, let's just go home and drink coffee. Well obviously this here doesn WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
about APIs, let's just go home and drink coffee. Well obviously this here doesn
't give you much
more information just by simply knowing what each letter represents but the
name here actually
is pretty descriptive, believe or not. It really is a way for us to interface
or interact with
particular applications, particularly in a programmatic manner. So let me show
you what I mean.
Let's imagine we've got a little application over here, we'll just call this
app one okay
and all the way over here we're going to have application to a completely
separate app. So I don't
know let's maybe say this application is some type of chatting application, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
know let's maybe say this application is some type of chatting application,
maybe something like
say Slack or Cisco WebEx that type of thing, basically a place whereby you can
type particular
messages to your friends chatting communicate have all that type of fun. Now
over here let's imagine
that this is some type of weather application whereby it's going to gather
information and statistics
based on particular locations. So if you use this app you can give it your GPS
coordinates, find
it your location and then determine what the weather should be for the next
week okay so completely
different applications and who knows behind the scenes they may be written in WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
different applications and who knows behind the scenes they may be written in
completely different
programming languages. Let's just imagine that this one here is written in the
Python programming
language whereas this one here is written in the Go programming language. So
the question I have
is what actually happens if these two applications want to be able to
communicate with one another.
So say for example we wanted to have some type of automated service whereby in
the chatting
application maybe we've got a dedicated room for the weather and all this
application does is WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
application does is
automatically reaches out to the weather application and ingest the data and
populate it within
the actual application right here okay. Can a similar to how your cell phone
might work you
may open up your application and suddenly you see that you're getting
information about weather
updates on the home screen. This information could be very well coming from an
external source
and external app completely. So we've got two different applications two
different code bases
entirely but they want to communicate. Now the way they're actually going to
communicate is via
the use of APIs. So really at its core what does an API actually give you for WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
the use of APIs. So really at its core what does an API actually give you for
real? Quite simply
it's a way for you to interact with your application in these simplified manner
without having to
care about all the back end details how the application is actually programmed
and all the wonderful
things going on the background. It's just your door to using that application
to get information
from it to pass information to it. Pretty much the API here is going to be the
doorway for you.
Let me help you understand this via a well known analogy okay. This is the way WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Let me help you understand this via a well known analogy okay. This is the way
that I learned about
APIs and when I heard it it really did help the whole concept. Click for me. So
let's imagine you want
to go to a restaurant okay. So let me just show you my good skills of drawing
here as the restaurant
right here. Now in here this can be the kitchen whereby all of the chefs are
working. Okay so you
get your chefs here you've got all your pots on your stoves on, frying pans are
going, people are
cutting vegetables that type of thing. Now you as a customer who actually wants
to will enjoy the
services offered up via this restaurant at either food they're serving you walk WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
services offered up via this restaurant at either food they're serving you walk
in and you sit down
at a table. Now think about how do you actually get the food that you want. Do
you have to understand
how many chefs in the kitchen? Do you have to understand how many knives there
are? How many pots
and pans there are? You do not care about any of this stuff whatsoever. The
only thing that you do in
order to get the services you want is that you just talk directly to the waiter
okay. So the waiter
might come here give you a list of all the available services via a menu and WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
might come here give you a list of all the available services via a menu and
you just go hey Mr.
waiter I would just like to order and then give your order I would like to have
a pizza that type of
thing okay. So this is your way of interacting with all of this magic in the
background that you
really don't have to care about. Now the waiter effectively takes your request
and release it back
to the staff in the kitchen and now all of this fantastic teamwork kicks in
your food has begun to
be prepared. Now here's the thing let's maybe say 15 minutes of past and your
food is still not there.
If you want to get information i.e. a query about the state of your request but WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
If you want to get information i.e. a query about the state of your request but
once again you just
directly ask the waiter to really that information and the waiter can go and
get an update and say hey
how long is this food going to be and then the waiter can find out you know it
's going to be another
three minutes and the waiter can therefore tell you this information there'll
be three more minutes
and now you have the latest update of the information. Now this has got nothing
to do with coding or
automation but this is really close to how API's operates. Imagine you have a
web server that is
offering services this is like what you're getting in the kitchen if you want WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
offering services this is like what you're getting in the kitchen if you want
to consume and enjoy
whatever the service happens to be offering then the way you get that
information is by communicating via
this middleman ultimately simplifies the process. From your point of view you
just simply ask for
what you want and then suddenly due to the API or the waiter all of this
complexity happens in the
background and you're served up exactly what you ask for. Same kind of thing
like if you happen to
have a vending machine okay you walk out in your lunch break here is the v
ending machine once again my
art is absolutely awesome and let's maybe say we've got some you know some WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
art is absolutely awesome and let's maybe say we've got some you know some
stuff right here. So what
do you do you walk up on your lunch break you decide you want to have maybe a
bar of chocolate.
Now what do you actually do notice that actually is a little menu here like a
little keypad type
thing and all you do is you walk up to the keypad and this is a part you
interact with okay so then
maybe you type in something like say a five and then maybe some type of robotic
arm slides along
here goes up and fetches the item that you're doing then pulls all the way back
down and there
might be a little slot down here and your chocolate bar is released whereby you WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
might be a little slot down here and your chocolate bar is released whereby you
can stick your hand in
and pull it out. So once again this is an example of you're not having to care
about the details
of all the robotics happening in the background you don't care about the
programming logic all you
effectively do is interact with this via this simplified entry point this is
once again kind of
an analogy to what we're talking about with APIs you have a simplified entry
points and that's really
all you have to care about when getting the services that you're after. So let
me actually show you WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
me actually show you
an example of using an API just so that you can see that they're really not
that complex to
use in fact I am willing to bed you have used this type of API before let's
imagine that studying
Cisco networking is getting you a little bit stressed out and you want to go to
a vacation so what
do you do you go to a website like this Expedia in this case right here what I
'm going to do is to
choose my location so let's go down here let's maybe say I'm going to let's say
the Bahamas okay
and then I can specify when it is I want to go let's go from the 9th of WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and then I can specify when it is I want to go let's go from the 9th of
September to the 15th we'll
say done now right now if I just run a search what is going to happen here as
you can see as a whole
bunch of queries are being made and we get the response already now right here
why I actually did
was ultimately kick off a whole bunch of API requests quite simply I specified
very particular
details that I wanted okay now Expedia doesn't just have a database with all of
the potential things
that you can effectively ask for what they do is they take this information
okay and they bundle
up programmatically and they begin firing it off to the APIs of all of these WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
up programmatically and they begin firing it off to the APIs of all of these
different providers so
we might be talking to like British Airways or to Delta Airlines that type of
thing getting
information from them directly from their systems to actually determine you
know what flight times
are available correspond with this particular request and we are essentially
aggregating them
and presenting them here all in one place from me as a user to look at and
examine and again it's
not just flight she could be querying you could be querying a whole bunch of
different hotels in that
particular area like a Mario or a Hilton that type of thing quite simply we are WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
particular area like a Mario or a Hilton that type of thing quite simply we are
using Expedia to go
and talk to all of the different providers so Expedia on her behalf is actually
making API calls
with a talking to the British Airways API they're talking to the Virgin
Airlines API that type of thing
gathering all the information and seeing which data is relevant for my
particular request now in a
similar way let's say I go to book a particular deal once again I give the
information to Expedia
and then Expedia sends off these requests to these API endpoints to ensure that WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and then Expedia sends off these requests to these API endpoints to ensure that
I'm actually booking
with the hotel and the hotel get my information and ensuring that I'm actually
booking with the flight
provider and ensuring they get my information and again you could do this on
your phone you could open
up the Expedia application which is one app and if it wants to have to talk to
the British Airways
application all the Virgin application that type of thing these requests are
all made to each
applications API and then ultimately sent back so this really is the basic
concept behind APIs it's
going to facilitate communication programmatically between applications in a WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
going to facilitate communication programmatically between applications in a
nice simplified manner
now that we have that part under a belt the next thing that I want to talk
about is a very particular
type of API and this one is known as your rest API let's talk about that in the
very next video