I'm using aws integration api gateway with lambda and i have data mapping template. The url with query is like
https://example.com/query?value1=val1&value1=val2&value1=val3
I'm trying to pass all those params to lambda, but have no luck - only last value is passed. Here is part of data mapping template.
"queryStringParameters": {
#foreach($queryParam in $input.params().querystring.keySet())
"$queryParam": "$util.escapeJavaScript($input.params().querystring.get($queryParam))" #if($foreach.hasNext),#end
#end
},
I know that there is multivaluequerystringparameters in aws proxy integration but had no luck finding them using data mapping template. Here is test results:
Method request query string: {value1=[val1,val2,val3]}
Endpoint request body after transformations: "queryStringParameters": {"value1": "val3"}
Tried to iterate through that parameter like in VTL using #foreach but had no luck with that too
So... i had two ways, send my param as
&value1=[1,2,3]
or use aws_proxy and access this value1 from event
multiValueQueryStringParameters
I choosed the last one.