AWS Certified Developer – Associate — Question 343
A developer is exposing an API by using Amazon API Gateway and AWS Lambda as the backend for an application. The developer wants to add validation rules for a POST method to ensure that the data from the frontend web form is valid. The validation rules must include mandatory fields, data type, length, and regular expressions.
Which solution will meet these requirements?
Answer options
- A. Create an API Gateway model with schema for data validation.
- B. Create API Gateway HTTP request headers for data validation.
- C. Create API Gateway URL query string parameters for data validation.
- D. Create API Gateway URL path parameters for data validation.
Correct answer: A
Explanation
To validate the structure and content of a POST request body in Amazon API Gateway, you must define a model using JSON Schema, which supports constraints like mandatory fields, data types, length, and regular expressions. Options B, C, and D are incorrect because headers, query strings, and path parameters cannot be used to validate complex payload bodies with these specific rules.