Using #set

You can use #set to define a variable that can be used within the template.

Our (original) template is as follows:

{ 
"name" : $input.json('$.user.name'),
"time": $input.json('$.greeting.time')
}

The template, when rewritten by using #set, is as follows:

#set($inputRoot = $input.path('$'))
{
"name" : "$inputRoot.user.name",
"time": "$inputRoot.greeting.time"
}
The $inputRoot is also the variable name that is autogenerated by API Gateway in the AWS Management Console. However, you are free to use any name.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.247.125