2 Answers
- Newest
- Most votes
- Most comments
0
Hello.
If you look at the Lambda log, the element "queryStringParameters" contains parameters.
Therefore, you can check the "Username" by getting the parameters with "event.get('queryStringParameters')" as shown below.
https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html
import json
def lambda_handler(event, context):
param = event.get('queryStringParameters')
print(param['Username'])
If you include the request body, it will be included in an element called "body", so you can retrieve it as follows.
import json
def lambda_handler(event, context):
print(event)
param = event.get('queryStringParameters')
print(param['Username'])
body = event.get('body')
print(json.loads(body)['Username'])
A sample request that includes a request body looks like this:
curl 'https://test.lambda-url.ap-northeast-1.on.aws/?Username=Elvis' -H 'content-type: application/json' -d '{ "Username": "test" }'
Relevant content
- asked 2 months ago
- asked a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 4 years ago