I try to using api gateway and query data direct to dynamo db. I has epoch time in path param and i tried to minus epoch by one day to query data in dynamodb but it not work. I tried convert by Interger.paserInt and some way but not work Please help me This is my body mapping templates
#set($epoch = $input.params('epoch'))
#set($secondInADay = 43200)
#set($start = $epoch - $secondInADay)
{
"TableName":"my-table",
"KeyConditionExpression":"#type_alias=:v1 AND epoch BETWEEN :startTime AND :endTime",
"ExpressionAttributeValues":{
":v1":{"S":"m"},
":startTime":{"N":"$util.urlDecode($start.toString())"},
":endTime":{"N":"$util.urlDecode($epoch.toString())"}
},
"ExpressionAttributeNames":{"#type_alias":"my hashkey"}
}
To convert it to a number you can use the following syntax: