Search⌘ K
AI Features

Customising Responses

Understand how to customize responses from AWS Lambda functions integrated with API Gateway. Explore formatting JSON responses, sending HTML content, and setting appropriate headers to deliver web pages. This lesson guides you through deploying and testing these customized responses to build interactive web forms and troubleshoot common issues.

API Gateway expects responses in a specific format from Lambda Proxy integrations. The response needs to be a JSON object containing these fields:

  • statusCode should be a number containing the numeric HTTP response code. The number 200 means OK.
  • body should be a string representing the response contents.
  • headers is an optional argument​ and can contain a map of HTTP response headers.

SAM assumes that you’ll use API Gateway to create JSON ...