I am trying to create an api url with 2 params in Api gateway with lambda. I already tried with mapping query params and that is working fine but I want to add params in url. With one params its working fine but with 2 its showing error that Resource's path part only allow a-zA-Z0-9._-: or a valid greedy path variable and curly braces at the beginning and the end.
If i just use {userid+}
that is working fine but I need to add 2 params
2
Answers
Having a path-based parameter that contains
+
sign inside is called a greedy path, which means that the downstream integration of the endpoint will handle all request starting with the prefix of the path.eg. Consider a function with a greedy path defined as
path: /horses/{proxy+}
. This lambda function will handle all request that starts with/horses
regarless of the depth of the sub-resource and its verb.Thus having the 2nd greedy path in a single URL is invalid.
Perhaps you may wanna consider using a POST resource to handle a request that will accept a request body instead.
You will then have to issue a POST request to it using popular libraries such as
fetch
You can use greedy path parameter only at the end of the url.
In your case just rename
{userid+}
to{userid}
.You should have
{userid}/{username+}