Creating a REST API in Amazon API Gateway
In Amazon API Gateway, you build a REST API as a collection of programmable entities known as
API Gateway resources. For example, you use a RestApi
resource to represent
an API that can contain a collection of Resource
entities. Each Resource
entity can in
turn have one or more Method
resources. Expressed in the request parameters and body, a Method
defines the
application programming interface for the client to access the exposed Resource
and represents an incoming request submitted by the client. You then create an Integration
resource to
integrate the Method
with a backend endpoint, also known as the integration
endpoint, by forwarding the incoming request to a specified integration endpoint URI. If
necessary, you transform request parameters or body to meet the backend requirements. For
responses, you can create a MethodResponse
resource to represent a request response
received by the client and you create an IntegrationResponse
resource to represent the request response
that is returned by the backend. You can configure the integration response to transform the
backend response data before returning the data to the client or to pass the backend
response as-is to the client.
To help your customers understand your API, you can also provide documentation for the
API, as part of the API creation or after the API is created. To enable this, add a DocumentationPart
resource for a supported API entity.
To control how clients call an API, use IAM permissions, a Lambda authorizer, or an Amazon Cognito user pool. To meter the use of your API, set up usage plans to throttle API requests. You can enable these when creating or updating the API.
You can perform these and other tasks by using the API Gateway console, the API Gateway REST API, the AWS CLI, or one of the AWS SDKs. We discuss how to perform these tasks next.
Topics