首页 > 移动平台 > 详细

[AWS DA] API Gateway: Mapping Templates

时间:2021-06-01 15:25:25      阅读:21      评论: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`.

 

技术分享图片

 

技术分享图片

 

技术分享图片

[AWS DA] API Gateway: Mapping Templates

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!