A developer is designing a high-throughput REST API using Amazon API Gateway that integrates directly with Amazon DynamoDB via an AWS Service integration. The API must write client request payloads directly to a DynamoDB table. The developer needs to ensure that:
1. The incoming JSON payload is validated to confirm it contains all required fields before calling DynamoDB.
2. The DynamoDB JSON response is transformed into an XML payload with a Content-Type of `application/xml` before being sent back to the client.
Which two configurations must the developer perform in Amazon API Gateway to meet these requirements? (Select TWO.)
- Define a JSON schema Model for the request payload, and configure a Request Validator on the API method to validate the request body.Answer
- Define a Method Response for a `` status code, and configure an Integration Response mapping template for the `application/xml` Content-Type to transform the DynamoDB response.Answer
- CConfigure a Lambda Authorizer to validate the request payload schema and return the transformed XML payload to the client in the authorization response context.
- DEnable a Lambda Proxy Integration and write a Velocity Template Language (VTL) mapping template to parse the incoming request body.
- EConfigure a CORS configuration on the API resource to automatically format the output content type to `application/xml` for the client.
Answer
The developer must define a JSON schema Model for the request payload and associate it with a Request Validator to check the request body. Additionally, they must configure a Method Response for the `` status code and map the response via an Integration Response template configured for the `application/xml` Content-Type.
To perform validation on incoming request bodies directly at the API Gateway layer, a JSON schema Model must be mapped to the request body, and a Request Validator must be configured on the method. To convert the database JSON payload to XML, a Method Response must first be defined for the desired response code, and an Integration Response must use a mapping template configured for the `application/xml` Content-Type.
Step-by-Step Solution
Key Concept
Amazon API Gateway Request Validation and Integration Response Mapping
Estimated Time:2m 0s