Menu
Amazon API Gateway
Developer Guide

x-amazon-apigateway-gateway-responses.gatewayResponse Object

Defines a gateway response of a given response type, including the status code, any applicable response parameters, or response templates.

Properties

Property Name Type Description
responseParameters x-amazon-apigateway-gateway-responses.responseParameters

Specifies the GatewayResponse parameters, namely the header parameters. The parameter values can take any incoming request parameter value or a static custom value.

responseTemplates x-amazon-apigateway-gateway-responses.responseTemplates

Specifies the mapping templates of the gateway response. The templates are not processed by the VTL engine.

statusCode string

An HTTP status code for the gateway response.

x-amazon-apigateway-gateway-responses.gatewayResponse Example

The following example of the API Gateway extension to Swagger defines a GatewayResponse to customize the INVALID_API_KEY response to return the status code of 456, the incoming request's api-key header value, and "Bad api-key" message.

Copy
"INVALID_API_KEY": { "statusCode": "456", "responseParameters": { "gatewayresponse.header.api-key": "method.request.header.api-key" }, "responseTemplates": { "application/json": "{\"message\": \"Bad api-key\" }" } }