API Gateway query string parameters in 1.0

I just started playing around a bit with Serverless 1.0 but I can’t find how to define a query string parameter for an API Gateway endpoint.
I tried the “0.5” way of adding {myParameter} in the path, but it seems like this is not translated to anything and is just part of the path.

Is It supported yet?


The following works for me:

- http: get hello/{test}

The path will then be available inside the event object.

yeah sorry, my bad. For some reason I was expecting it to show up as a query string parameter, which is of course a totally different thing (to my defense, it was very late :slight_smile: ). All good.

With that said though, how would I declare query string parameters from the serverless config?


You don’t need to define the Query parameters in serverless config at all. If you add query parameters to the request they should show up in the event data

1 Like

How do you get the event data if you’re using the aws-java-gradle
template instead of node.js? The context object doesn’t seem to have it, and I can’t find path & query param data anywhere else… https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/Context.java

Maybe this should be in the docs as an example I also struggled with this now

1 Like