[AWS DA] API Gateway: Mapping Templates

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[AWS DA] API Gateway: Mapping Templates相关的知识,希望对你有一定的参考价值。

 

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的主要内容,如果未能解决你的问题,请参考以下文章

如果在 Terraform 模块中创建了 aws_api_gateway_integration,如何在 aws_api_gateway_deployment 资源上填充depends_on?

从AWS API-Gateway中找出lambda名称

响应未定义 - aws-api-gateway-client

AWS API Gateway:用户匿名无权执行 API

AWS API Gateway 默认响应和触发 AWS Lambda

是否可以使用 AWS API 为 Lambda 函数设置 AWS API Gateway 端点?