[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:

[AWS DA] API Gateway: Mapping Templates

In this case, we can use Mapping Templates.

 

To create a Mapping Template for a Method:

[AWS DA] API Gateway: Mapping Templates

[AWS DA] API Gateway: Mapping Templates

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

 

[AWS DA] API Gateway: Mapping Templates

 

[AWS DA] API Gateway: Mapping Templates

 

[AWS DA] API Gateway: Mapping Templates

相关文章:

  • 2021-09-12
  • 2021-05-26
  • 2021-11-12
  • 2021-10-29
  • 2021-06-19
  • 2021-09-07
  • 2021-11-15
  • 2021-11-21
猜你喜欢
  • 2021-11-18
  • 2021-06-18
  • 2021-11-02
  • 2021-06-16
  • 2022-12-23
  • 2022-02-11
相关资源
相似解决方案