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?
- Access the parameters from the queryStringParameters property of the input JSON event passed to the Lambda function.Cevap
- BConfigure an API Gateway mapping template in the integration request to map the parameters to the Lambda function payload.
- CRetrieve the parameters directly from the Lambda context object during execution.
- DSet 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
Anahtar Kavram
Lambda Proxy Integration Request Structure