

# x-amazon-apigateway-integration.responses 객체
<a name="api-gateway-swagger-extensions-integration-responses"></a>

 메서드의 응답을 정의하고 통합 응답에서 메서드 응답으로 파라미터 매핑 또는 페이로드 매핑을 지정합니다.


| 속성 이름 | 유형 | 설명 | 
| --- | --- | --- | 
| 응답 상태 패턴 | [x-amazon-apigateway-integration.response 객체](api-gateway-swagger-extensions-integration-response.md) |  메서드 응답에 대한 통합 응답을 일치시키는 데 사용되는 정규식이거나 구성하지 않은 응답을 포착하는 `default`입니다. HTTP 통합의 경우 이 regex가 통합 응답 상태 코드에 적용됩니다. Lambda 호출의 경우 Lambda 함수 실행에서 예외가 발생할 경우 AWS Lambda에서 반환한 오류 정보 객체의 `errorMessage` 필드에 regex가 실패 응답 본문으로 적용됩니다. *응답 상태 패턴* 속성 이름은 응답 상태 코드 그룹을 설명하는 응답 상태 코드 또는 정규 표현식을 참조합니다. 이는 API Gateway REST API의 [IntegrationResponse](https://docs.aws.amazon.com/apigateway/latest/api/API_IntegrationResponse.html) 리소스의 ID에 해당되지 않습니다.  | 

## `x-amazon-apigateway-integration.responses` 예제
<a name="api-gateway-swagger-extensions-responses-example"></a>

다음 예에서는 `2xx` 및 `302` 응답의 응답 목록을 표시합니다. `2xx` 응답의 경우 메서드 응답이 `application/json` 또는 `application/xml` MIME 유형의 통합 응답의 페이로드에서 매핑됩니다. 이 응답에서는 제공된 매핑 템플릿을 사용합니다. `302` 응답의 경우 메서드 응답은 통합 응답의 페이로드에 있는 `Location` 속성에서 값이 파생되는 `redirect.url` 헤더를 반환합니다.

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

