aws-cdk-lib.aws_apigateway.IntegrationResponse

interface IntegrationResponse

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.IntegrationResponse
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#IntegrationResponse
Javasoftware.amazon.awscdk.services.apigateway.IntegrationResponse
Pythonaws_cdk.aws_apigateway.IntegrationResponse
TypeScript (source)aws-cdk-lib » aws_apigateway » IntegrationResponse

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
const integrationResponse: apigateway.IntegrationResponse = {
  statusCode: 'statusCode',

  // the properties below are optional
  contentHandling: apigateway.ContentHandling.CONVERT_TO_BINARY,
  responseParameters: {
    responseParametersKey: 'responseParameters',
  },
  responseTemplates: {
    responseTemplatesKey: 'responseTemplates',
  },
  selectionPattern: 'selectionPattern',
};

Properties

NameTypeDescription
statusCodestringThe status code that API Gateway uses to map the integration response to a MethodResponse status code.
contentHandling?ContentHandlingSpecifies how to handle request payload content type conversions.
responseParameters?{ [string]: string }The response parameters from the backend response that API Gateway sends to the method response.
responseTemplates?{ [string]: string }The templates that are used to transform the integration response body.
selectionPattern?stringSpecifies the regular expression (regex) pattern used to choose an integration response based on the response from the back end.

statusCode

Type: string

The status code that API Gateway uses to map the integration response to a MethodResponse status code.


contentHandling?

Type: ContentHandling (optional, default: none the request payload is passed through from the method request to the integration request without modification.)

Specifies how to handle request payload content type conversions.


responseParameters?

Type: { [string]: string } (optional)

The response parameters from the backend response that API Gateway sends to the method response.

Use the destination as the key and the source as the value:

  • The destination must be an existing response parameter in the MethodResponse property.
  • The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on the destination specified in the request.

See also: http://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html


responseTemplates?

Type: { [string]: string } (optional)

The templates that are used to transform the integration response body.

Specify templates as key-value pairs, with a content type as the key and a template as the value.

See also: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html


selectionPattern?

Type: string (optional)

Specifies the regular expression (regex) pattern used to choose an integration response based on the response from the back end.

For example, if the success response returns nothing and the error response returns some string, you could use the .+ regex to match error response. However, make sure that the error response does not contain any newline (\n) character in such cases. If the back end is an AWS Lambda function, the AWS Lambda function error header is matched. For all other HTTP and AWS back ends, the HTTP status code is matched.

See also: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-integration-settings-integration-response.html