AWS Certified Developer – Associate (DVA-C02) — Question 272
A company is using Amazon API Gateway to develop an API for its application on AWS. A developer needs to test and generate API responses. Other teams are required to test the API immediately.
What should the developer do to meet these requirements?
Answer options
- A. Set up a mock integration request in API Gateway. Configure the method's integration request and integration response to associate a response with a given status code.
- B. Set up the request validators in the API's OpenAPI definition file. Import the OpenAPI definitions into API Gateway to test the API.
- C. Set up a gateway response for the API in API Gateway. Configure response headers with hardcoded HTTP status codes and responses.
- D. Set up a request parameter-based Lambda authorizer to control access to the API. Configure the Lambda function with the necessary mapping template.
Correct answer: A
Explanation
A mock integration in Amazon API Gateway allows developers to return simulated API responses directly from the gateway without calling a backend service. This enables dependent teams to start testing their integrations immediately with predefined status codes and payloads. Other options, such as using gateway responses or Lambda authorizers, do not provide the capability to mock standard API endpoint responses.