Per an answer to this question I tried a mapping template as follows. I had a variable called "body" being passed which was a JSON structure with several child fields, and now that is gone.
{
"client_ip" : "$input.params('X-Forwarded-For')",
"user_agent" : "$input.params('User-Agent')"
}
I tried adding it like this, but still not getting the "body" with its child fields.
{
"client_ip" : "$input.params('X-Forwarded-For')",
"user_agent" : "$input.params('User-Agent')",
"body": "$input.params('body')"
}
Here is a sample of a my "body" element and some of the child fields:
2021-06-06T13:30:01.231-05:00 pprint event:
2021-06-06T13:30:01.231-05:00 {'body': {'ResponseTimeMilliseconds': 2225,
2021-06-06T13:30:01.231-05:00 'authToken': '12312312',
2021-06-06T13:30:01.231-05:00 'handNumber': 7}}
Should I use
{
"client_ip" : "$input.params('X-Forwarded-For')",
"user_agent" : "$input.params('User-Agent')",
"body" : $input.json('body')
}
or
{
"client_ip" : "$input.params('X-Forwarded-For')",
"user_agent" : "$input.params('User-Agent')",
"body" : $input.json('$')
}
or hopefully I do not have to spell out all the child fields.
I just have one test environment, and every time I try something that doesn't work, I'm impacting other people.
I've been referencing this page: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html