I use API-Gateway to map rest requests to some Lambda functions. It works fine for post methods, where i send my information in the body as JSON and access it in the lambda like so
module.exports.handler = function(event, context, cb) {
var email = event.email;
var name = event.name;
}
Now i wanted to create a GET, with query strings. On the request side on API-Gateway its fine you can select the query string names, but for the life of me I cant figure out what to do on the Integration Request side. How do i get my query strings into my lambda so that i can access them like above. Or are they accessed differently.
I went through the docs, and still dont understand it. You would think this is like the most basic use case and they have an example, but no.
Please can somebody help me
Thanks
You have to create method request parameters for your query string parameters, then you need to create a mapping template to map your query string parameters to the integration request body.
The mapping template will be something like this,
{
"email": "$input.params('email')",
"name": "$input.params('name')"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With