DVA-C02 · Question #497
A developer is updating an Amazon API Gateway REST API to have a mock endpoint. The developer wants to update the integration request mapping template so the endpoint will respond to mock integration
The correct answer is B. { #if( $input.params('scope') == "internal" ) "statusCode": 200 #else "statusCode": 500 #end }. Option B is correct because it uses the proper Apache Velocity Template Language (VTL) syntax for API Gateway mapping templates, checking a query string parameter ('scope') using $input.params() and returning appropriate HTTP status codes (200 for success, 500 for error). For moc
Question
A developer is updating an Amazon API Gateway REST API to have a mock endpoint. The developer wants to update the integration request mapping template so the endpoint will respond to mock integration requests with specific HTTP status codes based on various conditions. Which statement will meet these requirements? A. B. C. D.
Exhibits
Options
- A{ #if($input.params('integration') == "mock") "statusCode": 404 #else "statusCode": 500 #end }
- B{ #if( $input.params('scope') == "internal" ) "statusCode": 200 #else "statusCode": 500 #end }
- C{ #if( $input.path("integration") ) "statusCode": 200 #else "statusCode": 404 #end }
- D{ #if( $context.integration.status) "statusCode": 200 #else "statusCode": 500 #end }
How the community answered
(38 responses)- A3% (1)
- B79% (30)
- C13% (5)
- D5% (2)
Explanation
Option B is correct because it uses the proper Apache Velocity Template Language (VTL) syntax for API Gateway mapping templates, checking a query string parameter ('scope') using $input.params() and returning appropriate HTTP status codes (200 for success, 500 for error). For mock integrations in API Gateway, the integration request mapping template must return a statusCode that maps to a configured integration response, and using $input.params() to read request parameters to conditionally set the statusCode is the standard, supported pattern. The 200 and 500 status codes represent realistic mock responses that would be configured in the integration responses.
Topics
Community Discussion
No community discussion yet for this question.



