Amazon API Gateway
Developer Guide

x-amazon-apigateway-integration.response Object

Defines a response and specifies parameter mappings or payload mappings from the integration response to the method response.


Property Name Type Description
statusCode string

HTTP status code for the method response; for example, "200". This must correspond to a matching response in the Swagger Operation responses field.

responseTemplates x-amazon-apigateway-integration.responseTemplates Object

Specifies MIME type-specific mapping templates for the response’s payload.

responseParameters x-amazon-apigateway-integration.responseParameters Object

Specifies parameter mappings for the response. Only the header and body parameters of the integration response can be mapped to the header parameters of the method.

contentHandling string Response payload encoding conversion types. Valid values are 1) CONVERT_TO_TEXT, for converting a binary payload into a Base64-encoded string or converting a text payload into a utf-8-encoded string or passing through the text payload natively without modification, and 2) CONVERT_TO_BINARY, for converting a text payload into Base64-decoded blob or passing through a binary payload natively without modification.

x-amazon-apigateway-integration.response Example

The following example defines a 302 response for the method that derives a payload of the application/json or application/xml MIME type from the backend. The response uses the supplied mapping templates and returns the redirect URL from the integration response in the method's Location header.

{ "statusCode" : "302", "responseTemplates" : { "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$\", \"user-id\": \"$root.key\" }", "application/xml" : "#set ($root=$input.path('$')) <stage>$</stage> " }, "responseParameters" : { "method.response.header.Location": "integration.response.body.redirect.url" } }