Jump to content

AWS Integration Response Mapping

CraigShields

Hey All,

 

Does anyone here have experience with AWS REST APIs and Integration Response Mapping? I seem to be struggling with something that should be very simple. 

 

So I have a Lambda function that returns an error. The default response would be this

 

{
  "errorType": "string",
  "errorMessage": "{\"statusCode\":400,\"body\":{\"message\":\"Invalid Body\",\"errorDateTime\":\"2021-11-08T15:50:04.238Z\"}}",
  "trace": []
}

I have changed the Integration Response mapping to be the following

image.thumb.png.5ad4e4568c13f4a2e61e536980b0b333.png

 

This now returns the response like so

 

{
  "statusCode": 400,
  "body": {
    "message": "Invalid Body",
    "errorDateTime": "2021-11-08T15:51:25.998Z"
  }
}

My next step is that I only want to return the body in the response like so

 

  {
    "message": "Invalid Body",
    "errorDateTime": "2021-11-08T15:51:25.998Z"
  }

but for some reason I can't get access to the body key from the object and have no idea why. 

 

Anyone got any ideas?

 

Thanks

Craig

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

A better place for such question would be on StackOverflow

i5-4690k, R9 380 4gb, 8gb-1600MHz ram, corsair vs 550w, astrock h97m anniversary.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×