Ask Your Question
4

How can requestId be added to the request body using a mapping template in API Gateway?

asked 2023-06-18 23:32:30 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-18 23:55:02 +0000

huitzilopochtli gravatar image

To add a requestId to the request body using a mapping template in API Gateway, you can use the following steps:

  1. In the API Gateway console, go to your API's Resources page and select the desired resource method.
  2. Click on the Integration Request card to show the integration options.
  3. Under Mapping Templates, create a new mapping template by selecting "Add mapping template".
  4. Select "application/json" as the Content-Type and enter the input for the new mapping template.
  5. To add the requestId to the request body, use the following code in the template:
{
  "requestId": "$context.requestId"
}
  1. Click "Save".
  2. Finally, deploy the updated API. Once deployed, the requestId will be added to the request body of all incoming requests.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-18 23:32:30 +0000

Seen: 14 times

Last updated: Jun 18 '23