1
00:00:00,300 --> 00:00:06,270
In this video, we are going to walk through Amazon API Gateway for the rest API with the list management

2
00:00:06,270 --> 00:00:06,900
console.

3
00:00:07,140 --> 00:00:09,570
So please open the console.

4
00:00:09,600 --> 00:00:11,520
Go to the API gateway.

5
00:00:12,740 --> 00:00:16,110
You can see that we will choose an API type.

6
00:00:16,130 --> 00:00:23,750
This time we will choose the rest API because we will level up the rest API where we gain complete control

7
00:00:23,750 --> 00:00:27,710
over the request and response along the API management capabilities.

8
00:00:27,980 --> 00:00:35,330
And we will work with the Lambda functions, HTTP methods and available services is the same way in

9
00:00:35,330 --> 00:00:36,230
the rest API.

10
00:00:36,320 --> 00:00:40,820
So please create an API with clicking mute button.

11
00:00:42,590 --> 00:00:47,410
So you can see that we are creating a new rest API.

12
00:00:47,420 --> 00:00:52,910
So we are going to choose a protocol and we will select a rest protocol.

13
00:00:53,090 --> 00:00:57,290
And if you scroll down we are going to create a new API.

14
00:00:57,740 --> 00:00:59,550
This is creating a new API.

15
00:00:59,570 --> 00:01:08,030
I'm going to select a new API and here you can see that we can provide API name, description and end

16
00:01:08,030 --> 00:01:10,140
point in Amazon API Gateway.

17
00:01:10,160 --> 00:01:16,310
Rest API refers to collection of resources and methods that we can invoke through the HTTPS endpoint.

18
00:01:16,400 --> 00:01:24,800
I'm going to create an API and give the API name as a product API and the endpoint type will be regional.

19
00:01:24,830 --> 00:01:29,330
We will leave as it is and click the create API button.

20
00:01:31,790 --> 00:01:38,630
As you can see that you can see API Gateway Management page that we expose, API integrate with Lambda

21
00:01:38,630 --> 00:01:39,400
and so on.

22
00:01:39,410 --> 00:01:46,250
So you can see the core concept in the left hand side, for example, resource stays, authorizers and

23
00:01:46,250 --> 00:01:46,850
so on.

24
00:01:47,060 --> 00:01:48,680
These are the core concepts.

25
00:01:48,680 --> 00:01:55,760
In the middle of the screen we have resource section, we don't have any resource now, so we can perform

26
00:01:55,760 --> 00:01:56,750
some actions.

27
00:01:56,750 --> 00:02:03,410
If you click these actions, you can see button, we can create method, create the resource, enable

28
00:02:03,410 --> 00:02:05,480
course, deploy API and so on.

29
00:02:05,480 --> 00:02:08,180
We will use these actions when creating our API.

30
00:02:08,450 --> 00:02:13,820
Let me start with to create a resource because resource is the first thing that we should create when

31
00:02:13,820 --> 00:02:15,440
we are using the rest APIs.

32
00:02:15,530 --> 00:02:19,730
So if you create resources, you can see the parameters.

33
00:02:19,730 --> 00:02:23,270
We can configure these child resource in here.

34
00:02:23,900 --> 00:02:30,050
As you can see that this will be configured as a proxy resource that we are set up proxy integration

35
00:02:30,050 --> 00:02:31,220
with proxy source.

36
00:02:31,220 --> 00:02:39,080
So in order to set up proxy integration in API, gateway API with a proxy source, we perform this create

37
00:02:39,080 --> 00:02:40,850
proxy source with the grid pit.

38
00:02:40,850 --> 00:02:46,910
For example, if you select this checkbox, this will be prepared and generate for the grid pad for

39
00:02:46,910 --> 00:02:49,850
me and this will be the proxy resource.

40
00:02:49,850 --> 00:02:53,450
That means it will be redirecting to downstream services.

41
00:02:53,750 --> 00:03:03,200
Now I'm not set this proxy resource now, so let me set a resource name for myself.

42
00:03:03,410 --> 00:03:09,080
For example, let me select the product so this will the product resource name.

43
00:03:09,080 --> 00:03:11,210
We can also add parameters.

44
00:03:11,210 --> 00:03:19,580
So for example, if you would like to add a pet parameters, we can add a slash and put an ID information

45
00:03:19,580 --> 00:03:20,230
in here.

46
00:03:20,550 --> 00:03:24,320
Here you can see that we adding the ID as a pet parameters.

47
00:03:24,470 --> 00:03:31,550
And also you can see documentation, the documentation it is adding the user name as a pet parameters

48
00:03:31,550 --> 00:03:36,830
or we can set a proxy settings that means after the product.

49
00:03:37,810 --> 00:03:43,560
Redirection wrote we can wrote every proxy request to the downstream services.

50
00:03:43,570 --> 00:03:48,610
For now I am not going to do anything and I am leaving as it is as a product.

51
00:03:48,610 --> 00:03:51,490
So now I'm not enabled any course.

52
00:03:51,490 --> 00:03:56,680
Settings only create a resource which name is product and click the create resource button.

53
00:03:58,380 --> 00:04:02,580
So as you can see that we have successfully created resource in located in here.

54
00:04:02,580 --> 00:04:10,310
So under the resources we can select the actions and create methods, but make sure that you selected

55
00:04:10,320 --> 00:04:11,640
the correct resource.

56
00:04:11,640 --> 00:04:16,500
We can also select the root section and also we can also select the product resources.

57
00:04:16,500 --> 00:04:21,120
So select the product resource and click the actions create method.

58
00:04:21,390 --> 00:04:27,900
So as you can see that there is the dropdown box is open for the creating a product methods.

59
00:04:27,900 --> 00:04:35,430
So if you expand this dropdown, we can see that any options we can get this we can create method for

60
00:04:35,430 --> 00:04:35,850
that purpose.

61
00:04:35,850 --> 00:04:39,560
I'm going to select, get and click this icon.

62
00:04:39,690 --> 00:04:42,210
See that in the configuration page.

63
00:04:42,330 --> 00:04:49,260
We can choose the integration point for our method and waiting for lambda functions, but we don't have

64
00:04:49,260 --> 00:04:50,040
any lambda function.

65
00:04:50,040 --> 00:04:53,040
You can see the integration type is lambda function.

66
00:04:53,130 --> 00:05:01,050
So since we don't have any lambda function, we can select the mock and save this method.

67
00:05:01,140 --> 00:05:07,170
You can see that we have created the easy to get method under the product resources here.

68
00:05:07,170 --> 00:05:13,410
This is an illustration for the HTTP request and also we can select the resource again come the actions

69
00:05:13,410 --> 00:05:16,920
create method and this time I'm going to select post method.

70
00:05:16,920 --> 00:05:23,310
So click this icon to save this post method and you can leave as this don't save.

71
00:05:23,310 --> 00:05:30,810
And we also see these HTTP methods in here even we don't set the integration type and configure this

72
00:05:30,810 --> 00:05:31,410
function.

73
00:05:31,800 --> 00:05:32,410
Okay.

74
00:05:32,430 --> 00:05:34,950
Also, we have create a proxy resources.

75
00:05:34,950 --> 00:05:40,260
So how we can create a proxy resources under the product resource, please select the product source

76
00:05:40,260 --> 00:05:41,670
and come to actions.

77
00:05:41,670 --> 00:05:48,630
And under the product resource, we can create any resource under this hierarchical resource section.

78
00:05:48,870 --> 00:05:57,060
So if we click the product resource and come to actions and create resources, this will be create resources

79
00:05:57,060 --> 00:05:58,890
under the product section.

80
00:05:58,890 --> 00:06:03,960
This time I'm going to select the proxy resources.

81
00:06:03,990 --> 00:06:11,640
If you take this checkbox, this will be create a resource name, which is the proxy and the suspect

82
00:06:11,640 --> 00:06:14,820
as you can see, that product slash proxy plus.

83
00:06:14,820 --> 00:06:22,920
So that means any HTP method and any URL can configure in this configuration if you provide the product

84
00:06:22,950 --> 00:06:24,000
into the URL.

85
00:06:24,360 --> 00:06:27,090
So just click to create resource.

86
00:06:28,190 --> 00:06:34,880
And see that under the product resource we have get and post method and also we have proxy definition.

87
00:06:34,880 --> 00:06:42,950
That means any of the method will be in our configuration, but we didn't configure yet for the downstream

88
00:06:42,950 --> 00:06:43,520
services.

89
00:06:43,520 --> 00:06:50,360
So that's why this will not any invocation to send request to the system services.

90
00:06:50,360 --> 00:06:58,280
I'm going to explain how we can create resources and methods under the rest API configuration page.

91
00:06:58,280 --> 00:07:06,170
So if we think, think that we have finished the our product API design, we can deploy our API for

92
00:07:06,170 --> 00:07:06,830
that purpose.

93
00:07:06,830 --> 00:07:12,230
I'm going to come to actions and see that we can deploy API button in here.

94
00:07:12,230 --> 00:07:21,680
If you click the deploy API, see that it is expecting a stage for deployment like test and stage,

95
00:07:21,770 --> 00:07:22,430
so on.

96
00:07:22,430 --> 00:07:28,640
So we have to define a deployment stage like testing, production and so on.

97
00:07:28,640 --> 00:07:31,460
Choose a state where your API will be deployed.

98
00:07:31,460 --> 00:07:36,770
For example, a test version of our API could be deployed on a stage, name, beta and so on.

99
00:07:36,770 --> 00:07:44,450
We can create a naive stage in here if you click the stage and but also you can create a stage from

100
00:07:44,450 --> 00:07:45,260
the left hand side.

101
00:07:45,260 --> 00:07:46,970
You can see the stage in here.

102
00:07:47,000 --> 00:07:51,260
Let me show the left hand side as you can see that here the stage.

103
00:07:51,260 --> 00:07:55,220
These are the core concepts that we can create stage in here.

104
00:07:55,550 --> 00:08:02,150
For now I'm going to create stage from the resources, open the resources, select product actions,

105
00:08:02,150 --> 00:08:04,790
deploy API in the deployment stage.

106
00:08:04,790 --> 00:08:11,030
Selected new stage and stage team will be the payload for the production and I don't give any description

107
00:08:11,030 --> 00:08:12,530
and click to deploy button.

108
00:08:13,360 --> 00:08:18,880
So as you can see that there is an exception which is the no integration defined for methods.

109
00:08:19,180 --> 00:08:26,530
So if you are not redirecting anywhere in the HTTP methods, it doesn't allow to deploy our API.

110
00:08:26,590 --> 00:08:31,090
So for that purpose, come here and select the eight methods one by one.

111
00:08:31,090 --> 00:08:37,510
For example, eight, we get method, we are redirecting to mock so there is no any problem and http

112
00:08:37,510 --> 00:08:38,290
post method.

113
00:08:38,290 --> 00:08:42,530
We also required any integration type in order to deploy this API.

114
00:08:42,550 --> 00:08:48,010
For that purpose, I'm going to select again and save this method.

115
00:08:48,070 --> 00:08:54,610
So as you can see that we have method, request and method response and integration request and integration

116
00:08:54,610 --> 00:08:55,300
response.

117
00:08:55,330 --> 00:09:03,820
This is the illustration how we can invoke the API gateway and how the direct invocation is goes the

118
00:09:03,820 --> 00:09:09,610
steps, it becomes the method, method, request, and go to integration request and go to downstream

119
00:09:09,610 --> 00:09:10,930
services and response.

120
00:09:10,930 --> 00:09:17,200
Back the integration response and come back the method response and go to the client application.

121
00:09:17,200 --> 00:09:23,870
So these are the illustration that we can manage our method, request and response and map and method,

122
00:09:23,870 --> 00:09:26,440
the response according to client requirements.

123
00:09:26,920 --> 00:09:35,710
So as you can see that we have set the mock endpoints and here you can see the an example request we

124
00:09:35,710 --> 00:09:44,020
will send the get product and this will be sent the integration request to the our downstream mock response.

125
00:09:44,170 --> 00:09:51,520
So is the same way please select all the methods to the mock end point and I'm going to remove these

126
00:09:51,520 --> 00:09:53,320
proxy settings.

127
00:09:53,320 --> 00:09:55,930
Let me delete resource.

128
00:09:56,790 --> 00:09:57,540
Okay.

129
00:09:58,250 --> 00:10:03,760
So now we have only get and post and they are integrating with the end point.

130
00:10:03,800 --> 00:10:06,570
That means we can deploy our API.

131
00:10:06,590 --> 00:10:07,990
Now it is ready.

132
00:10:08,000 --> 00:10:10,970
So come to select the product and actions.

133
00:10:10,970 --> 00:10:12,230
Deploy API.

134
00:10:12,260 --> 00:10:15,290
The deployment stage is new stage, which is the process.

135
00:10:15,410 --> 00:10:18,890
This time all methods is mapping with the integration.

136
00:10:18,890 --> 00:10:21,920
So that's why it should be low to deploy our API.

137
00:10:21,950 --> 00:10:23,180
Click to deploy button.

138
00:10:23,810 --> 00:10:29,990
Now as you can see that we have successfully create our API gateway raised API with this endpoint here

139
00:10:29,990 --> 00:10:35,520
is generating an endpoint and we can invoke this URL by clicking if we right click open.

140
00:10:35,540 --> 00:10:38,580
If that, we can invoke our application.

141
00:10:38,600 --> 00:10:44,720
So if you invoke this URL, you can see the message missing authentication token.

142
00:10:44,780 --> 00:10:51,590
So this response coming because we don't have any proxy integration, we have product resource and product

143
00:10:51,590 --> 00:10:53,510
resource has gate and POS method.

144
00:10:53,540 --> 00:10:59,360
In order to test get product method, we should append the product suffix at the end of the URL.

145
00:10:59,390 --> 00:11:04,310
You can see come here and it slash product and hit enter.

146
00:11:04,340 --> 00:11:07,130
This time we are successfully send the request.

147
00:11:07,160 --> 00:11:11,530
Since we integrate with the mock response, there is no any returning response.

148
00:11:11,540 --> 00:11:15,280
You can see this URL from the API gateway under the stage.

149
00:11:15,290 --> 00:11:17,410
You can see the stage under the plot.

150
00:11:17,420 --> 00:11:22,580
We have a product resource and under the product we have get method and get method.

151
00:11:22,580 --> 00:11:27,770
We can see the inaugural a pending product request in here, right click open new tab.

152
00:11:27,800 --> 00:11:29,810
We don't have any exception now.

153
00:11:30,980 --> 00:11:32,930
As you can see that there is no error now.

154
00:11:32,960 --> 00:11:40,760
And also you can see that if you send a request, if you click the F12 to see the old toolbox come to

155
00:11:40,880 --> 00:11:50,210
our network in the network section, we will see that if you send again, we will send product request

156
00:11:50,210 --> 00:11:52,850
and it is also impacted 200 success code.

157
00:11:53,060 --> 00:11:59,600
So that means we are successful send http get method and it is shown back us successful response.

158
00:11:59,900 --> 00:12:07,400
If you come to state again you can see the states and see the hydrological information about the resources

159
00:12:07,400 --> 00:12:08,340
and the methods.

160
00:12:08,360 --> 00:12:15,280
This is the core concepts in the rest API that we can invoke our active method design and integrate

161
00:12:15,290 --> 00:12:17,410
with the downstream services.

162
00:12:17,420 --> 00:12:18,170
Okay, very good.

163
00:12:18,170 --> 00:12:22,610
We have finished walk through with Amazon API Gateway for the rest API using the Advanced Management

164
00:12:22,610 --> 00:12:23,180
console.

165
00:12:23,210 --> 00:12:26,960
In the next video, we are going to talk about enable request validation.
