1
00:00:00,908 --> 00:00:04,770
-: (Memi) So let's talk about what is an API.

2
00:00:04,770 --> 00:00:06,030
As you probably remember,

3
00:00:06,030 --> 00:00:09,870
the title of this course is about REST API.

4
00:00:09,870 --> 00:00:12,240
So we'll talk about REST later.

5
00:00:12,240 --> 00:00:14,550
Let's begin with the API part.

6
00:00:14,550 --> 00:00:19,550
So API is an acronym of Application Programming Interface.

7
00:00:20,250 --> 00:00:22,470
Now if it doesn't make sense to you

8
00:00:22,470 --> 00:00:25,890
then let's look at the Wikipedia explanation of API.

9
00:00:25,890 --> 00:00:27,750
So according to Wikipedia

10
00:00:27,750 --> 00:00:31,680
an API is a set of clearly defined methods

11
00:00:31,680 --> 00:00:34,830
of communication among various components.

12
00:00:34,830 --> 00:00:37,080
Now notice that the components part

13
00:00:37,080 --> 00:00:41,700
in this explanation refers to software components.

14
00:00:41,700 --> 00:00:42,533
But first,

15
00:00:42,533 --> 00:00:45,333
let's talk about the interface part of the API.

16
00:00:46,230 --> 00:00:49,500
You're probably familiar with user interface.

17
00:00:49,500 --> 00:00:52,410
User interface is what you the user,

18
00:00:52,410 --> 00:00:54,900
sees when you look at something.

19
00:00:54,900 --> 00:00:56,220
In the case of websites,

20
00:00:56,220 --> 00:00:58,410
it's probably the homepage of the websites

21
00:00:58,410 --> 00:00:59,940
that you are browsing to.

22
00:00:59,940 --> 00:01:04,940
So interface is the part that is exposed to you the user.

23
00:01:05,040 --> 00:01:07,470
And the word exposed here is very,

24
00:01:07,470 --> 00:01:09,960
very important as we will see later.

25
00:01:09,960 --> 00:01:12,360
So this is a part that is exposed

26
00:01:12,360 --> 00:01:15,090
to you when you try to use something.

27
00:01:15,090 --> 00:01:18,150
And as an end user or as a human,

28
00:01:18,150 --> 00:01:21,720
the interface is a visual representation

29
00:01:21,720 --> 00:01:23,943
of the content that you are looking at.

30
00:01:25,350 --> 00:01:29,040
The same is also true for application interface.

31
00:01:29,040 --> 00:01:30,960
In application interface,

32
00:01:30,960 --> 00:01:35,700
the interface is the part that is exposed to an application

33
00:01:35,700 --> 00:01:37,560
not to an end user.

34
00:01:37,560 --> 00:01:38,820
And what you see right now

35
00:01:38,820 --> 00:01:42,120
on the screen is a specific kind of an API

36
00:01:42,120 --> 00:01:43,920
or an interface

37
00:01:43,920 --> 00:01:47,100
that is exposed by an application.

38
00:01:47,100 --> 00:01:48,870
Now you the end user,

39
00:01:48,870 --> 00:01:49,920
the human,

40
00:01:49,920 --> 00:01:53,430
you are not supposed to ever see this kind of API.

41
00:01:53,430 --> 00:01:54,570
It makes no sense.

42
00:01:54,570 --> 00:01:58,380
It has a lot of letters, a lot of numbers, some slashes,

43
00:01:58,380 --> 00:02:02,010
and it basically completely incomprehensible for humans.

44
00:02:02,010 --> 00:02:05,610
But application fully understands this.

45
00:02:05,610 --> 00:02:09,780
Now take a look at the first line of this API.

46
00:02:09,780 --> 00:02:12,210
This is the address of the API.

47
00:02:12,210 --> 00:02:15,420
This is the address of the interface that

48
00:02:15,420 --> 00:02:17,217
the application is going to use.

49
00:02:17,217 --> 00:02:20,340
And this is the main part we are going to deal with

50
00:02:20,340 --> 00:02:21,660
in this course.

51
00:02:21,660 --> 00:02:23,100
But again before,

52
00:02:23,100 --> 00:02:26,130
we are going to dive into the REST API,

53
00:02:26,130 --> 00:02:27,630
or into web API.

54
00:02:27,630 --> 00:02:30,540
Let's first understand what is the terminology

55
00:02:30,540 --> 00:02:33,780
that we are going to use when talking about API.

56
00:02:33,780 --> 00:02:35,160
So in this example,

57
00:02:35,160 --> 00:02:36,930
we have two softwares.

58
00:02:36,930 --> 00:02:39,270
We have users management software,

59
00:02:39,270 --> 00:02:41,730
and we have orders management software.

60
00:02:41,730 --> 00:02:43,350
And those two softwares,

61
00:02:43,350 --> 00:02:45,390
they want to communicate with each other.

62
00:02:45,390 --> 00:02:46,470
For example,

63
00:02:46,470 --> 00:02:50,460
the users software wants to access the orders software

64
00:02:50,460 --> 00:02:53,976
and ask it what are the orders that were made

65
00:02:53,976 --> 00:02:55,500
by a specific user.

66
00:02:55,500 --> 00:02:57,720
So in order to do that,

67
00:02:57,720 --> 00:03:01,260
the users software goes to the orders software.

68
00:03:01,260 --> 00:03:02,430
With this question.

69
00:03:02,430 --> 00:03:05,040
I want to get the users orders.

70
00:03:05,040 --> 00:03:09,865
Now how does the users software talk to the orders software?

71
00:03:09,865 --> 00:03:12,863
The order software publishes an API.

72
00:03:12,863 --> 00:03:17,040
The API is the thing that the users software can see

73
00:03:17,040 --> 00:03:20,430
and access and use it in order to get access

74
00:03:20,430 --> 00:03:24,270
to the internal data stored in the orders software.

75
00:03:24,270 --> 00:03:27,330
Now this kind of API publishing

76
00:03:27,330 --> 00:03:29,877
called exposing an API.

77
00:03:29,877 --> 00:03:34,410
The API is exposed by the orders management software

78
00:03:34,410 --> 00:03:37,170
and after it is exposed and becomes public

79
00:03:37,170 --> 00:03:41,073
then other software or other software components can use it.

