In this video, we are going to walk through Amazon API Gateway for the rest API with the list management
console.
So please open the console.
Go to the API gateway.
You can see that we will choose an API type.
This time we will choose the rest API because we will level up the rest API where we gain complete control
over the request and response along the API management capabilities.
And we will work with the Lambda functions, HTTP methods and available services is the same way in
the rest API.
So please create an API with clicking mute button.
So you can see that we are creating a new rest API.
So we are going to choose a protocol and we will select a rest protocol.
And if you scroll down we are going to create a new API.
This is creating a new API.
I'm going to select a new API and here you can see that we can provide API name, description and end
point in Amazon API Gateway.
Rest API refers to collection of resources and methods that we can invoke through the HTTPS endpoint.
I'm going to create an API and give the API name as a product API and the endpoint type will be regional.
We will leave as it is and click the create API button.
As you can see that you can see API Gateway Management page that we expose, API integrate with Lambda
and so on.
So you can see the core concept in the left hand side, for example, resource stays, authorizers and
so on.
These are the core concepts.
In the middle of the screen we have resource section, we don't have any resource now, so we can perform
some actions.
If you click these actions, you can see button, we can create method, create the resource, enable
course, deploy API and so on.
We will use these actions when creating our API.
Let me start with to create a resource because resource is the first thing that we should create when
we are using the rest APIs.
So if you create resources, you can see the parameters.
We can configure these child resource in here.
As you can see that this will be configured as a proxy resource that we are set up proxy integration
with proxy source.
So in order to set up proxy integration in API, gateway API with a proxy source, we perform this create
proxy source with the grid pit.
For example, if you select this checkbox, this will be prepared and generate for the grid pad for
me and this will be the proxy resource.
That means it will be redirecting to downstream services.
Now I'm not set this proxy resource now, so let me set a resource name for myself.
For example, let me select the product so this will the product resource name.
We can also add parameters.
So for example, if you would like to add a pet parameters, we can add a slash and put an ID information
in here.
Here you can see that we adding the ID as a pet parameters.
And also you can see documentation, the documentation it is adding the user name as a pet parameters
or we can set a proxy settings that means after the product.
Redirection wrote we can wrote every proxy request to the downstream services.
For now I am not going to do anything and I am leaving as it is as a product.
So now I'm not enabled any course.
Settings only create a resource which name is product and click the create resource button.
So as you can see that we have successfully created resource in located in here.
So under the resources we can select the actions and create methods, but make sure that you selected
the correct resource.
We can also select the root section and also we can also select the product resources.
So select the product resource and click the actions create method.
So as you can see that there is the dropdown box is open for the creating a product methods.
So if you expand this dropdown, we can see that any options we can get this we can create method for
that purpose.
I'm going to select, get and click this icon.
See that in the configuration page.
We can choose the integration point for our method and waiting for lambda functions, but we don't have
any lambda function.
You can see the integration type is lambda function.
So since we don't have any lambda function, we can select the mock and save this method.
You can see that we have created the easy to get method under the product resources here.
This is an illustration for the HTTP request and also we can select the resource again come the actions
create method and this time I'm going to select post method.
So click this icon to save this post method and you can leave as this don't save.
And we also see these HTTP methods in here even we don't set the integration type and configure this
function.
Okay.
Also, we have create a proxy resources.
So how we can create a proxy resources under the product resource, please select the product source
and come to actions.
And under the product resource, we can create any resource under this hierarchical resource section.
So if we click the product resource and come to actions and create resources, this will be create resources
under the product section.
This time I'm going to select the proxy resources.
If you take this checkbox, this will be create a resource name, which is the proxy and the suspect
as you can see, that product slash proxy plus.
So that means any HTP method and any URL can configure in this configuration if you provide the product
into the URL.
So just click to create resource.
And see that under the product resource we have get and post method and also we have proxy definition.
That means any of the method will be in our configuration, but we didn't configure yet for the downstream
services.
So that's why this will not any invocation to send request to the system services.
I'm going to explain how we can create resources and methods under the rest API configuration page.
So if we think, think that we have finished the our product API design, we can deploy our API for
that purpose.
I'm going to come to actions and see that we can deploy API button in here.
If you click the deploy API, see that it is expecting a stage for deployment like test and stage,
so on.
So we have to define a deployment stage like testing, production and so on.
Choose a state where your API will be deployed.
For example, a test version of our API could be deployed on a stage, name, beta and so on.
We can create a naive stage in here if you click the stage and but also you can create a stage from
the left hand side.
You can see the stage in here.
Let me show the left hand side as you can see that here the stage.
These are the core concepts that we can create stage in here.
For now I'm going to create stage from the resources, open the resources, select product actions,
deploy API in the deployment stage.
Selected new stage and stage team will be the payload for the production and I don't give any description
and click to deploy button.
So as you can see that there is an exception which is the no integration defined for methods.
So if you are not redirecting anywhere in the HTTP methods, it doesn't allow to deploy our API.
So for that purpose, come here and select the eight methods one by one.
For example, eight, we get method, we are redirecting to mock so there is no any problem and http
post method.
We also required any integration type in order to deploy this API.
For that purpose, I'm going to select again and save this method.
So as you can see that we have method, request and method response and integration request and integration
response.
This is the illustration how we can invoke the API gateway and how the direct invocation is goes the
steps, it becomes the method, method, request, and go to integration request and go to downstream
services and response.
Back the integration response and come back the method response and go to the client application.
So these are the illustration that we can manage our method, request and response and map and method,
the response according to client requirements.
So as you can see that we have set the mock endpoints and here you can see the an example request we
will send the get product and this will be sent the integration request to the our downstream mock response.
So is the same way please select all the methods to the mock end point and I'm going to remove these
proxy settings.
Let me delete resource.
Okay.
So now we have only get and post and they are integrating with the end point.
That means we can deploy our API.
Now it is ready.
So come to select the product and actions.
Deploy API.
The deployment stage is new stage, which is the process.
This time all methods is mapping with the integration.
So that's why it should be low to deploy our API.
Click to deploy button.
Now as you can see that we have successfully create our API gateway raised API with this endpoint here
is generating an endpoint and we can invoke this URL by clicking if we right click open.
If that, we can invoke our application.
So if you invoke this URL, you can see the message missing authentication token.
So this response coming because we don't have any proxy integration, we have product resource and product
resource has gate and POS method.
In order to test get product method, we should append the product suffix at the end of the URL.
You can see come here and it slash product and hit enter.
This time we are successfully send the request.
Since we integrate with the mock response, there is no any returning response.
You can see this URL from the API gateway under the stage.
You can see the stage under the plot.
We have a product resource and under the product we have get method and get method.
We can see the inaugural a pending product request in here, right click open new tab.
We don't have any exception now.
As you can see that there is no error now.
And also you can see that if you send a request, if you click the F12 to see the old toolbox come to
our network in the network section, we will see that if you send again, we will send product request
and it is also impacted 200 success code.
So that means we are successful send http get method and it is shown back us successful response.
If you come to state again you can see the states and see the hydrological information about the resources
and the methods.
This is the core concepts in the rest API that we can invoke our active method design and integrate
with the downstream services.
Okay, very good.
We have finished walk through with Amazon API Gateway for the rest API using the Advanced Management
console.
In the next video, we are going to talk about enable request validation.