I want to get the query string on the Lambda side when accessing https://example.com/beta/resource
with GET
Click ʻIntegration Request` in API Gateway
Open the Mapping Templates
section and enter ʻapplication / json in
content-type`
Click the ʻInput passthrough pencil on the right and select
Mapping Templates`
Enter and save as follows
{
#foreach( $key in $input.params().querystring.keySet() )
"$key": "$input.params().querystring.get($key)"#if( $foreach.hasNext ),#end
#end
}
Now the query string is stored in the first argument ʻevent` of lambda_function ().
Reference: http://r7kamura.hatenablog.com/entry/2015/08/14/043134
Recommended Posts