WEBVTT

1
00:00.000 --> 00:04.990
Alright friends, let's now talk about something known as an API. You may have

2
00:04.990 --> 00:05.520
heard of this

3
00:05.520 --> 00:09.520
term many times before and you are just a little bit confused as to what it's

4
00:09.520 --> 00:10.320
all about.

5
00:10.320 --> 00:14.730
It can be a little bit obscure and a little bit esoteric the first time you

6
00:14.730 --> 00:15.440
hear it. So let's try

7
00:15.440 --> 00:20.400
to demystify what an earth this is all about. The first thing to state is that

8
00:20.400 --> 00:21.600
an API is just an

9
00:21.600 --> 00:26.680
acronym for an application programming interface. Okay great, class is over, we

10
00:26.680 --> 00:27.360
now know everything

11
00:27.360 --> 00:33.470
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

11
00:27.360 --> 00:33.470
about APIs, let's just go home and drink coffee. Well obviously this here doesn

12
00:33.470 --> 00:34.240
't give you much

13
00:34.240 --> 00:38.940
more information just by simply knowing what each letter represents but the

14
00:38.940 --> 00:39.920
name here actually

15
00:39.920 --> 00:43.690
is pretty descriptive, believe or not. It really is a way for us to interface

16
00:43.690 --> 00:44.560
or interact with

17
00:44.560 --> 00:48.560
particular applications, particularly in a programmatic manner. So let me show

18
00:48.560 --> 00:49.360
you what I mean.

19
00:49.360 --> 00:52.320
Let's imagine we've got a little application over here, we'll just call this

20
00:52.320 --> 00:53.280
app one okay

21
00:53.280 --> 00:56.860
and all the way over here we're going to have application to a completely

22
00:56.860 --> 00:58.080
separate app. So I don't

23
00:58.080 --> 01:02.040
know let's maybe say this application is some type of chatting application,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

23
00:58.080 --> 01:02.040
know let's maybe say this application is some type of chatting application,

24
01:02.040 --> 01:02.800
maybe something like

25
01:02.800 --> 01:06.870
say Slack or Cisco WebEx that type of thing, basically a place whereby you can

26
01:06.870 --> 01:07.680
type particular

27
01:07.680 --> 01:11.560
messages to your friends chatting communicate have all that type of fun. Now

28
01:11.560 --> 01:13.520
over here let's imagine

29
01:13.520 --> 01:17.250
that this is some type of weather application whereby it's going to gather

30
01:17.250 --> 01:18.800
information and statistics

31
01:18.800 --> 01:23.100
based on particular locations. So if you use this app you can give it your GPS

32
01:23.100 --> 01:24.080
coordinates, find

33
01:24.080 --> 01:27.200
it your location and then determine what the weather should be for the next

34
01:27.200 --> 01:28.320
week okay so completely

35
01:28.320 --> 01:31.760
different applications and who knows behind the scenes they may be written in
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

35
01:28.320 --> 01:31.760
different applications and who knows behind the scenes they may be written in

36
01:31.760 --> 01:32.400
completely different

37
01:32.400 --> 01:36.140
programming languages. Let's just imagine that this one here is written in the

38
01:36.140 --> 01:37.040
Python programming

39
01:37.040 --> 01:41.920
language whereas this one here is written in the Go programming language. So

40
01:41.920 --> 01:43.600
the question I have

41
01:43.600 --> 01:47.460
is what actually happens if these two applications want to be able to

42
01:47.460 --> 01:49.360
communicate with one another.

43
01:49.360 --> 01:54.000
So say for example we wanted to have some type of automated service whereby in

44
01:54.000 --> 01:54.880
the chatting

45
01:54.880 --> 01:58.990
application maybe we've got a dedicated room for the weather and all this

46
01:58.990 --> 02:00.400
application does is
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

46
01:58.990 --> 02:00.400
application does is

47
02:00.400 --> 02:05.410
automatically reaches out to the weather application and ingest the data and

48
02:05.410 --> 02:06.880
populate it within

49
02:06.880 --> 02:10.080
the actual application right here okay. Can a similar to how your cell phone

50
02:10.080 --> 02:10.640
might work you

51
02:10.640 --> 02:13.140
may open up your application and suddenly you see that you're getting

52
02:13.140 --> 02:14.160
information about weather

53
02:14.160 --> 02:17.700
updates on the home screen. This information could be very well coming from an

54
02:17.700 --> 02:18.560
external source

55
02:18.560 --> 02:22.200
and external app completely. So we've got two different applications two

56
02:22.200 --> 02:23.520
different code bases

57
02:23.520 --> 02:28.170
entirely but they want to communicate. Now the way they're actually going to

58
02:28.170 --> 02:29.440
communicate is via

59
02:29.440 --> 02:34.500
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

59
02:29.440 --> 02:34.500
the use of APIs. So really at its core what does an API actually give you for

60
02:34.500 --> 02:35.520
real? Quite simply

61
02:35.520 --> 02:40.080
it's a way for you to interact with your application in these simplified manner

62
02:40.080 --> 02:40.720
without having to

63
02:40.720 --> 02:45.290
care about all the back end details how the application is actually programmed

64
02:45.290 --> 02:46.000
and all the wonderful

65
02:46.000 --> 02:50.320
things going on the background. It's just your door to using that application

66
02:50.320 --> 02:51.120
to get information

67
02:51.120 --> 02:55.280
from it to pass information to it. Pretty much the API here is going to be the

68
02:55.280 --> 02:56.400
doorway for you.

69
02:56.400 --> 03:00.400
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

69
02:56.400 --> 03:00.400
Let me help you understand this via a well known analogy okay. This is the way

70
03:00.400 --> 03:01.040
that I learned about

71
03:01.040 --> 03:05.690
APIs and when I heard it it really did help the whole concept. Click for me. So

72
03:05.690 --> 03:06.480
let's imagine you want

73
03:06.480 --> 03:09.640
to go to a restaurant okay. So let me just show you my good skills of drawing

74
03:09.640 --> 03:10.640
here as the restaurant

75
03:10.640 --> 03:15.470
right here. Now in here this can be the kitchen whereby all of the chefs are

76
03:15.470 --> 03:16.400
working. Okay so you

77
03:16.400 --> 03:20.590
get your chefs here you've got all your pots on your stoves on, frying pans are

78
03:20.590 --> 03:21.440
going, people are

79
03:21.440 --> 03:25.980
cutting vegetables that type of thing. Now you as a customer who actually wants

80
03:25.980 --> 03:27.040
to will enjoy the

81
03:27.040 --> 03:31.590
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

81
03:27.040 --> 03:31.590
services offered up via this restaurant at either food they're serving you walk

82
03:31.590 --> 03:32.800
in and you sit down

83
03:32.800 --> 03:37.230
at a table. Now think about how do you actually get the food that you want. Do

84
03:37.230 --> 03:38.880
you have to understand

85
03:38.880 --> 03:42.900
how many chefs in the kitchen? Do you have to understand how many knives there

86
03:42.900 --> 03:44.400
are? How many pots

87
03:44.400 --> 03:48.690
and pans there are? You do not care about any of this stuff whatsoever. The

88
03:48.690 --> 03:50.000
only thing that you do in

89
03:50.000 --> 03:54.650
order to get the services you want is that you just talk directly to the waiter

90
03:54.650 --> 03:55.680
okay. So the waiter

91
03:55.680 --> 04:00.210
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

91
03:55.680 --> 04:00.210
might come here give you a list of all the available services via a menu and

92
04:00.210 --> 04:01.440
you just go hey Mr.

93
04:01.440 --> 04:05.050
waiter I would just like to order and then give your order I would like to have

94
04:05.050 --> 04:06.000
a pizza that type of

95
04:06.000 --> 04:10.070
thing okay. So this is your way of interacting with all of this magic in the

96
04:10.070 --> 04:11.040
background that you

97
04:11.040 --> 04:15.330
really don't have to care about. Now the waiter effectively takes your request

98
04:15.330 --> 04:16.400
and release it back

99
04:16.400 --> 04:20.420
to the staff in the kitchen and now all of this fantastic teamwork kicks in

100
04:20.420 --> 04:21.680
your food has begun to

101
04:21.680 --> 04:25.460
be prepared. Now here's the thing let's maybe say 15 minutes of past and your

102
04:25.460 --> 04:26.640
food is still not there.

103
04:26.640 --> 04:32.140
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

103
04:26.640 --> 04:32.140
If you want to get information i.e. a query about the state of your request but

104
04:32.140 --> 04:33.200
once again you just

105
04:33.200 --> 04:36.630
directly ask the waiter to really that information and the waiter can go and

106
04:36.630 --> 04:38.240
get an update and say hey

107
04:38.240 --> 04:41.100
how long is this food going to be and then the waiter can find out you know it

108
04:41.100 --> 04:42.080
's going to be another

109
04:42.080 --> 04:45.700
three minutes and the waiter can therefore tell you this information there'll

110
04:45.700 --> 04:46.640
be three more minutes

111
04:46.640 --> 04:50.940
and now you have the latest update of the information. Now this has got nothing

112
04:50.940 --> 04:52.160
to do with coding or

113
04:52.160 --> 04:56.120
automation but this is really close to how API's operates. Imagine you have a

114
04:56.120 --> 04:57.040
web server that is

115
04:57.040 --> 05:00.920
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

115
04:57.040 --> 05:00.920
offering services this is like what you're getting in the kitchen if you want

116
05:00.920 --> 05:02.240
to consume and enjoy

117
05:02.240 --> 05:05.320
whatever the service happens to be offering then the way you get that

118
05:05.320 --> 05:07.280
information is by communicating via

119
05:07.280 --> 05:11.850
this middleman ultimately simplifies the process. From your point of view you

120
05:11.850 --> 05:12.800
just simply ask for

121
05:12.800 --> 05:16.830
what you want and then suddenly due to the API or the waiter all of this

122
05:16.830 --> 05:18.320
complexity happens in the

123
05:18.320 --> 05:22.240
background and you're served up exactly what you ask for. Same kind of thing

124
05:22.240 --> 05:23.200
like if you happen to

125
05:23.200 --> 05:26.150
have a vending machine okay you walk out in your lunch break here is the v

126
05:26.150 --> 05:27.520
ending machine once again my

127
05:27.520 --> 05:32.690
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

127
05:27.520 --> 05:32.690
art is absolutely awesome and let's maybe say we've got some you know some

128
05:32.690 --> 05:34.320
stuff right here. So what

129
05:34.320 --> 05:38.000
do you do you walk up on your lunch break you decide you want to have maybe a

130
05:38.000 --> 05:38.960
bar of chocolate.

131
05:38.960 --> 05:42.770
Now what do you actually do notice that actually is a little menu here like a

132
05:42.770 --> 05:43.760
little keypad type

133
05:43.760 --> 05:47.060
thing and all you do is you walk up to the keypad and this is a part you

134
05:47.060 --> 05:48.640
interact with okay so then

135
05:48.640 --> 05:52.860
maybe you type in something like say a five and then maybe some type of robotic

136
05:52.860 --> 05:53.760
arm slides along

137
05:53.760 --> 05:58.240
here goes up and fetches the item that you're doing then pulls all the way back

138
05:58.240 --> 05:58.800
down and there

139
05:58.800 --> 06:02.250
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

139
05:58.800 --> 06:02.250
might be a little slot down here and your chocolate bar is released whereby you

140
06:02.250 --> 06:03.440
can stick your hand in

141
06:03.440 --> 06:07.190
and pull it out. So once again this is an example of you're not having to care

142
06:07.190 --> 06:08.720
about the details

143
06:08.720 --> 06:12.160
of all the robotics happening in the background you don't care about the

144
06:12.160 --> 06:13.440
programming logic all you

145
06:13.440 --> 06:18.710
effectively do is interact with this via this simplified entry point this is

146
06:18.710 --> 06:20.000
once again kind of

147
06:20.000 --> 06:24.160
an analogy to what we're talking about with APIs you have a simplified entry

148
06:24.160 --> 06:25.200
points and that's really

149
06:25.200 --> 06:29.560
all you have to care about when getting the services that you're after. So let

150
06:29.560 --> 06:30.720
me actually show you
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

150
06:29.560 --> 06:30.720
me actually show you

151
06:30.720 --> 06:35.650
an example of using an API just so that you can see that they're really not

152
06:35.650 --> 06:36.720
that complex to

153
06:36.720 --> 06:41.500
use in fact I am willing to bed you have used this type of API before let's

154
06:41.500 --> 06:42.480
imagine that studying

155
06:42.480 --> 06:46.170
Cisco networking is getting you a little bit stressed out and you want to go to

156
06:46.170 --> 06:47.200
a vacation so what

157
06:47.200 --> 06:51.770
do you do you go to a website like this Expedia in this case right here what I

158
06:51.770 --> 06:52.960
'm going to do is to

159
06:52.960 --> 06:56.460
choose my location so let's go down here let's maybe say I'm going to let's say

160
06:56.460 --> 06:57.680
the Bahamas okay

161
06:57.680 --> 07:00.870
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

161
06:57.680 --> 07:00.870
and then I can specify when it is I want to go let's go from the 9th of

162
07:00.870 --> 07:02.480
September to the 15th we'll

163
07:02.480 --> 07:06.760
say done now right now if I just run a search what is going to happen here as

164
07:06.760 --> 07:07.920
you can see as a whole

165
07:07.920 --> 07:11.370
bunch of queries are being made and we get the response already now right here

166
07:11.370 --> 07:12.320
why I actually did

167
07:12.320 --> 07:17.090
was ultimately kick off a whole bunch of API requests quite simply I specified

168
07:17.090 --> 07:17.920
very particular

169
07:17.920 --> 07:22.900
details that I wanted okay now Expedia doesn't just have a database with all of

170
07:22.900 --> 07:24.160
the potential things

171
07:24.160 --> 07:28.500
that you can effectively ask for what they do is they take this information

172
07:28.500 --> 07:29.600
okay and they bundle

173
07:29.600 --> 07:34.190
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

173
07:29.600 --> 07:34.190
up programmatically and they begin firing it off to the APIs of all of these

174
07:34.190 --> 07:35.760
different providers so

175
07:35.760 --> 07:39.940
we might be talking to like British Airways or to Delta Airlines that type of

176
07:39.940 --> 07:40.800
thing getting

177
07:40.800 --> 07:45.350
information from them directly from their systems to actually determine you

178
07:45.350 --> 07:46.480
know what flight times

179
07:46.480 --> 07:50.110
are available correspond with this particular request and we are essentially

180
07:50.110 --> 07:51.120
aggregating them

181
07:51.120 --> 07:54.640
and presenting them here all in one place from me as a user to look at and

182
07:54.640 --> 07:55.760
examine and again it's

183
07:55.760 --> 07:58.540
not just flight she could be querying you could be querying a whole bunch of

184
07:58.540 --> 07:59.600
different hotels in that

185
07:59.600 --> 08:03.750
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

185
07:59.600 --> 08:03.750
particular area like a Mario or a Hilton that type of thing quite simply we are

186
08:03.750 --> 08:05.360
using Expedia to go

187
08:05.360 --> 08:09.590
and talk to all of the different providers so Expedia on her behalf is actually

188
08:09.590 --> 08:10.800
making API calls

189
08:10.800 --> 08:15.330
with a talking to the British Airways API they're talking to the Virgin

190
08:15.330 --> 08:17.200
Airlines API that type of thing

191
08:17.200 --> 08:21.000
gathering all the information and seeing which data is relevant for my

192
08:21.000 --> 08:22.400
particular request now in a

193
08:22.400 --> 08:26.040
similar way let's say I go to book a particular deal once again I give the

194
08:26.040 --> 08:27.760
information to Expedia

195
08:27.760 --> 08:32.380
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

195
08:27.760 --> 08:32.380
and then Expedia sends off these requests to these API endpoints to ensure that

196
08:32.380 --> 08:33.360
I'm actually booking

197
08:33.360 --> 08:37.000
with the hotel and the hotel get my information and ensuring that I'm actually

198
08:37.000 --> 08:38.000
booking with the flight

199
08:38.000 --> 08:41.820
provider and ensuring they get my information and again you could do this on

200
08:41.820 --> 08:42.880
your phone you could open

201
08:42.880 --> 08:46.720
up the Expedia application which is one app and if it wants to have to talk to

202
08:46.720 --> 08:47.840
the British Airways

203
08:47.840 --> 08:52.250
application all the Virgin application that type of thing these requests are

204
08:52.250 --> 08:53.280
all made to each

205
08:53.280 --> 08:57.660
applications API and then ultimately sent back so this really is the basic

206
08:57.660 --> 08:59.120
concept behind APIs it's

207
08:59.120 --> 09:02.600
going to facilitate communication programmatically between applications in a
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

207
08:59.120 --> 09:02.600
going to facilitate communication programmatically between applications in a

208
09:02.600 --> 09:04.080
nice simplified manner

209
09:04.080 --> 09:07.130
now that we have that part under a belt the next thing that I want to talk

210
09:07.130 --> 09:08.720
about is a very particular

211
09:08.720 --> 09:13.060
type of API and this one is known as your rest API let's talk about that in the

212
09:13.060 --> 09:14.560
very next video
