Data Mapping

Understand data mapping in API Gateway’s requests and responses.

Data flow

When we invoke a REST API, the data flows through a series of steps, as shown below:

  • The method request identifies the incoming request and extracts components like the path parameters, headers, and query parameters. It can validate the request based on these components.

  • The integration request maps the available inputs to the inputs required by the target API. It has the required IAM role needed to invoke the target API.

  • The target API could be a Lambda function, any AWS service, or an external URL our API invokes as part of the integration.

  • The integration response maps the response from the target service to the response expected by the API client.

  • The method response patches up the response so that it’s ready to return. This step can alter headers or the response status code based on the configuration.

The screenshot below shows a typical REST API with Lambda function integration.

Get hands-on with 1400+ tech skills courses.