Question #885
A developer is working on a travel booking platform that integrates with multiple third-party flight reservation APIs. These third-party APIs do not provide a test environment. The developer needs to test the integration code without making actual calls to the third-party APIs. Which solution meets these requirements?
Set up an Amazon API Gateway HTTP API with a default route that returns cached responses from previous third-party API calls.
Configure an AWS AppSync API with a resolver that maps to a mock data source using sample responses from the third-party APIs.
Create an AWS Lambda function that returns predefined responses matching the third-party APIs and configure an Amazon API Gateway to route requests to this Lambda.
Set up an Amazon API Gateway REST API for each third-party API, configure mock integrations with integration responses using sample data captured from the real APIs.
Explanation
Answer D is correct because Amazon API Gateway REST API's mock integration feature enables developers to configure predefined responses (using sample data) without backend systems. This allows testing integration logic without invoking real third-party APIs.
Why other options are incorrect:
- A: Cached responses require prior real API calls, which contradicts the requirement to avoid actual calls.
- B: AWS AppSync is GraphQL-based and adds unnecessary complexity for REST-based third-party APIs.
- C: Lambda with predefined responses works but introduces extra code/maintenance compared to API Gateway's native mock integration.
Key Points:
1. Use API Gateway mock integrations to simulate APIs without backend systems.
2. Mock integrations use static sample data, ideal for testing.
3. Avoid solutions requiring real API calls (caching) or additional compute resources (Lambda).
Answer
The correct answer is: D