WEBVTT

0
00:00.690 --> 00:05.010
First, let's take a look at what application programming interfaces

1
00:05.070 --> 00:10.070
are and then we'll see how we can use them to start pulling in some data from the

2
00:10.560 --> 00:13.290
internet. So when you're browsing the web,

3
00:13.320 --> 00:17.070
you might've realized that there's a lot of websites out there that carry a

4
00:17.070 --> 00:19.140
whole bunch of data. For example,

5
00:19.140 --> 00:24.140
you could go onto Yahoo weather and see next week's weather predictions for

6
00:24.390 --> 00:25.650
any city in the world,

7
00:26.100 --> 00:31.100
you could go onto Coinbase and see what is the current market value of various

8
00:31.650 --> 00:34.500
cryptocurrencies like Bitcoin and Ethereum.

9
00:35.130 --> 00:39.600
You can also go onto the MBA website and look at various stats about your

10
00:39.600 --> 00:42.330
favorite basketball players. Now,

11
00:42.480 --> 00:45.540
what if we wanted to use the data that they have?

12
00:45.780 --> 00:50.250
How can we tap into it and use it in our own programs? Well,

13
00:50.280 --> 00:53.790
that's where application programming interfaces come into play.

14
00:54.390 --> 00:58.320
They all are a set of commands, functions, protocols, and objects

15
00:58.680 --> 01:03.680
that programmers can use to create software or interact with an external system.

16
01:05.430 --> 01:06.720
In the upcoming lessons

17
01:06.750 --> 01:11.280
what we're going to be focusing on is this interacting with external systems.

18
01:11.970 --> 01:12.510
Namely,

19
01:12.510 --> 01:17.510
we're going to try and interact with various websites and pull live data from

20
01:17.910 --> 01:20.010
those websites. Essentially,

21
01:20.010 --> 01:25.010
the API is an interface or rather a sort of barrier between your program and an

22
01:26.940 --> 01:27.900
external system.

23
01:28.530 --> 01:33.530
And what you're trying to do is you're trying to use the rules that the API has

24
01:33.810 --> 01:38.810
prescribed to make a request to the external system for some piece of data.

25
01:40.650 --> 01:42.810
And if you have structured your request

26
01:43.080 --> 01:48.080
according to all of the requirements that this external system has set out in

27
01:48.090 --> 01:48.923
their API,

28
01:49.200 --> 01:54.200
then they will respond to you appropriately and give you the data that you want.

29
01:56.940 --> 01:58.830
But if you don't follow the rules,

30
01:59.040 --> 02:03.090
then your request will be invalid and they will tell you to go away.

31
02:04.260 --> 02:09.120
So if we think about the websites we saw before, Yahoo weather has a Yahoo

32
02:09.120 --> 02:10.050
weather  API

33
02:10.110 --> 02:14.700
which you can tap into using your programs or apps and get things like 10-day

34
02:14.700 --> 02:18.330
forecast, wind, atmosphere, astronomy conditions,

35
02:18.750 --> 02:21.360
and Coinbase has their own API,

36
02:21.420 --> 02:26.420
which lets you tap into the current live prices of various cryptocurrencies.

37
02:28.020 --> 02:32.310
And of course, the MBA also has an API for you to be able to get various

38
02:32.310 --> 02:37.310
information that you're interested in on leagues, teams, players, games and a whole

39
02:37.830 --> 02:38.663
bunch more.

40
02:39.630 --> 02:44.630
So essentially, you can imagine these websites as the sort of restaurant,

41
02:44.910 --> 02:45.330
right?

42
02:45.330 --> 02:50.330
And the data that powers these websites as the kitchen behind the scenes.

43
02:51.570 --> 02:56.570
We can't really go to a restaurant as a member of the public and just go in to

44
02:57.660 --> 03:01.150
the kitchen and start raiding their cupboards. You can't, you know,

45
03:01.810 --> 03:05.830
imagine going to your favorite Japanese restaurant and heading straight into the

46
03:05.830 --> 03:08.830
kitchen for some of your favorite Kewpie mayonnaise.

47
03:08.980 --> 03:12.160
That's not really appropriate. In a restaurant

48
03:12.190 --> 03:17.190
we have a menu and this menu is kind of like the interface between you and the

49
03:18.670 --> 03:19.503
restaurant.

50
03:19.690 --> 03:24.400
It's the thing that tells you what you can order and what you can't.

51
03:24.760 --> 03:28.420
So maybe you can get a cake, a sandwich or tea from the restaurant,

52
03:28.720 --> 03:32.380
but you can't just go into the kitchen and demand whatever it is that you want.

53
03:33.180 --> 03:37.170
Essentially an API is exactly that. It's the menu.

54
03:37.530 --> 03:41.850
It's all of the things that you can do to interact with

55
03:42.210 --> 03:45.240
an external system such as a website

56
03:45.240 --> 03:47.430
that carries data like Yahoo

57
03:47.430 --> 03:51.330
weather or the MBA website. In the coming lessons

58
03:51.360 --> 03:56.360
we're going to be looking at how we can read the documentation for the API and

59
03:56.520 --> 03:59.820
interact with them to be able to pull pieces of data that

60
03:59.880 --> 04:04.880
we want in the moment that we want it. So for all of that and more,

61
04:05.310 --> 04:06.360
I'll see on the next lesson.