[AWS DA] API Gateway: Mapping Templates

时间:2021-06-02 19:55:41   收藏:0   阅读:0

技术图片

 

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`.

 

技术图片

 

技术图片

 

技术图片

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!