Soru

Zorluk: KolayAPI Development and Integration with Amazon API Gateway

A developer is configuring an Amazon API Gateway REST API with a Lambda proxy integration. The developer needs to access the query string parameters sent by the client within the backend AWS Lambda function. How should the developer retrieve these parameters from the incoming request?

  1. Access the parameters from the queryStringParameters property of the input JSON event passed to the Lambda function.Cevap
  2. B
    Configure an API Gateway mapping template in the integration request to map the parameters to the Lambda function payload.
  3. C
    Retrieve the parameters directly from the Lambda context object during execution.
  4. D
    Set up a Cognito User Pool authorizer to parse the query string parameters from the client authorization header.

Cevap

Access the parameters from the queryStringParameters property of the input JSON event passed to the Lambda function.
In a Lambda proxy integration, API Gateway automatically formats the client's HTTP request details into a single JSON object and passes it to the backend Lambda function as the event parameter. Within this event payload, the query parameters are populated in the 'queryStringParameters' object, allowing direct access inside the function code.

Adım Adım Çözüm

1
Identify the API Gateway integration type configured in the scenario.
The integration type is Lambda proxy integration.
The integration type determines how request data is formatted and forwarded to the backend service.
2
Examine how client request data is passed in Lambda proxy integrations.
API Gateway passes the entire request as a structured JSON object to the first parameter (the event object) of the Lambda handler.
Understanding the input structure allows the developer to locate request metadata and parameter fields.
3
Access the specific key mapped to query parameters in the event structure.
Query parameters are nested under the 'queryStringParameters' property of the input event object.
This is the standard integration contract for Lambda proxy requests in API Gateway.

Anahtar Kavram

Lambda Proxy Integration Request Structure
Bu soruyu puanla