nerdexam
Amazon

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

Submitted by ngozi_ng· Mar 5, 2026Development with AWS Services - Implementing and managing serverless APIs using Amazon API Gateway, including configuring mock integrations and request/response mapping templates

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

DVA-C02 question #497 exhibit 1
DVA-C02 question #497 exhibit 2
DVA-C02 question #497 exhibit 3
DVA-C02 question #497 exhibit 4

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)
  • A
    3% (1)
  • B
    79% (30)
  • C
    13% (5)
  • D
    5% (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

#API Gateway#Mock Integration#Velocity Template Language#Mapping Templates

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice