Soru

Zorluk: OrtaAPI Development and Integration with Amazon API Gateway

A developer needs to configure an Amazon API Gateway REST API endpoint to return a static JSON payload and an HTTP 200200 OK status code for testing. To minimize latency and cost, the endpoint must not invoke any backend services or Lambda functions. Which two configuration steps must the developer perform to set up a Mock integration for this endpoint? (Select TWO.)

  1. Configure the Integration Request type as Mock, and define a mapping template for the application/json content type that outputs a JSON payload containing the statusCode property (e.g., {"statusCode": 200}).Cevap
  2. B
    Configure a Lambda Proxy integration with a Lambda function that returns a hardcoded JSON payload.
  3. Configure a Method Response for HTTP status 200200, and define an Integration Response that maps to it with a template containing the static JSON payload.Cevap
  4. D
    Use a custom Lambda Authorizer to intercept the request and return the static JSON payload inside the context object.
  5. E
    Create a custom Gateway Response with a custom status code and configure it to return the static JSON payload under the DEFAULT_4XX type.

Cevap

To configure a Mock integration, set the Integration Request type to Mock and define a mapping template that outputs a JSON payload containing the statusCode property. Then, configure a Method Response for HTTP status 200200 and map an Integration Response containing the static JSON payload to it.
A Mock integration allows API Gateway to return responses directly to the client without calling any downstream backend. Setting the integration type to Mock requires the integration request to specify a mapping template mapping the incoming request to a JSON object with a `statusCode` field. API Gateway uses this status code value to route the request to the matching Integration Response. To output the desired data, the developer must define an HTTP 200200 Method Response and write an Integration Response mapping template for that status code containing the static JSON payload.

Adım Adım Çözüm

1
Set the Integration Request type to Mock in API Gateway.
API Gateway is instructed to bypass backend routing and handle the request directly.
Mock integrations process the request internally within API Gateway.
2
Define an Integration Request mapping template for the content type application/json.
The template outputs a JSON object containing the statusCode parameter, such as {"statusCode": 200}.
API Gateway uses this statusCode value to select the correct integration response.
3
Define a Method Response for HTTP status 200200 and a matching Integration Response.
An integration response maps the internal statusCode to the client-facing HTTP 200200 response.
Allows returning the configured static JSON payload as the response body to the client.

Anahtar Kavram

API Gateway Mock Integration
Tahmini Süre:2m 0s
Bu soruyu puanla