Search code examples
aws-api-gatewayamazon-sns

AWS API Gateway: Get request body in response body


I have built an AWS API Gateway Rest API integration with AWS SNS.

(Setup in simplified form)

Post Requests --> RestAPI in AWS API Gateway -->SNS

I want to configure the Gateway to respond to the post request with one field I get from PostRequestsBody.

But in the docs that I have read, I am able to send just the response body of the SNS request.

1>Is it possible to respond with body PostRequest as a response body in Gateway?

2> if yes please direct me to the docs or please explain how it can be achieved.

I have gone through http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html which had explained just how to respond with details of integrated service(SNS in this case) response.


Solution

  • Even though this question is old now, it appears in search results.

    AWS doesn't directly have a way to do this, but people have found hacks such as https://stackoverflow.com/a/61482410/563812