Amazon API Gateway allows us to map our incoming requests to a format that's required by our Lambda, and map the response from the Lambda into a format that's required by the client, all by using the mapping templates. The API Gateway body mapping templates are based on the Apache Velocity Template Language (VTL) and JSONPath expressions.
In this recipe, we will see how to map a JSON body coming from a request into another JSON structure, as required by the backend (Lambda). We will also map the JSON response from the backend (Lambda) into a different JSON response structure which is sent back as the response. We will use the same Lambda from the recipe Building your first API with Lambda integration, but the client will send the request in a different format.