[AWS DA] API Gateway: Mapping Templates

时间:2021-06-01 15:25:25   收藏:0   阅读:33

技术分享图片

 

What does it means?

For example, if we have setup a API Gateway, REST API, GET method point to a Lambda function with no proxy intergration which return:

{
  "statusCode": 200,
  "body": "\"Hello from Lambda! mapping\""
}

[Notice]: If we set with Proxy integration, we will only get the body from the response "Hello from Lambda! mapping"; Mapping template can NOT be used with proxy

If no proxy, then we get whatever Lambda function return to us.

Now we want to mask the response field to a different one:

技术分享图片

In this case, we can use Mapping Templates.

 

To create a Mapping Template for a Method:

技术分享图片

技术分享图片

Here we renamed `statusCode` & `body`, and added new field `newField`.

 

技术分享图片

 

技术分享图片

 

技术分享图片

原文:https://www.cnblogs.com/Answer1215/p/14836881.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!