I am trying to create a template that maps an array of ids from a query string param to a json template. I can't seem to figure out how to do it. This is what I have so far:
{
"raw_ids_param_value": "$input.params('ids')",
"mapped_ids": [
#foreach($id in $input.params('ids'))
{
"id": "$id",
"foo": "bar"
}
#if($foreach.hasNext),#end
#end
]
}
When I make the request, you can see that the ids param is available, but it does nothing when I try to iterate over it:
GET /endpoint?ids=1,2,3
{
"raw_ids_param_value": "1,2,3",
"mapped_ids": [
]
}
What am I doing wrong?