is it possible to use JSON Numeric aggregation functions in API gateway map

0

As the subject says, I am looking if it is possible to use JSON Numeric aggregation functions in API gateway mapping templates?
I have the below template and I would want to add the "ttl" column as a future date.
{
"TableName": "api",
"Item": {
"ingestId": {
"S": "$context.requestId"
},
"ttl": {
"N": "$context.requestTimeEpoch"
}
}
}

So I wanted to try the sum() function of the request Epoch time and some number to get a future date as the result.
Any suggestions and inputs are welcome.

1개 답변
1

I had to use the set variable before the JSON structure. I was trying it inside and was failing at the syntax validation.
#set($milliseconds = $context.requestTimeEpoch + 2*86400000)

This sets the milliseconds variable to current epoch + 2 days and this variable can be used in subsequent JSON.

gsk308
답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠