Reputation: 18177
I have a Lambda that takes a list of skus,
{ "skus" : [
"sku1",
"sku2"
]
}
I want to invoke it from HTTP requests to either
/inventory/sku1,sku2
or
/inventory?sku=sku1&sku=sku2
How can I achieve that mapping in API Gateway?
Upvotes: 0
Views: 626
Reputation: 18177
You can use String::split for the path-based approach.
#set($skus = $input.params('skus').split(","))
{
"skus": [
#foreach($sku in $skus)
"$sku"
#if($foreach.hasNext),#end
#end
]
}
Upvotes: 3