A developer needs to configure an Amazon API Gateway REST API endpoint to return a static JSON payload and an HTTP 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.)
- 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
- BConfigure a Lambda Proxy integration with a Lambda function that returns a hardcoded JSON payload.
- Configure a Method Response for HTTP status , and define an Integration Response that maps to it with a template containing the static JSON payload.Cevap
- DUse a custom Lambda Authorizer to intercept the request and return the static JSON payload inside the context object.
- ECreate 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 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 Method Response and write an Integration Response mapping template for that status code containing the static JSON payload.
Adım Adım Çözüm
Anahtar Kavram
API Gateway Mock Integration
Tahmini Süre:2m 0s