

# x-amazon-apigateway-integration.responseTemplates 对象
<a name="api-gateway-swagger-extensions-integration-responseTemplates"></a>

 为给定的 MIME 类型响应负载指定映射模板。


| 属性名称 | 类型 | 说明 | 
| --- | --- | --- | 
| MIME type | string |  指定映射模板，将集成响应正文转换为给定 MIME 类型的方法响应正文。有关创建映射模板的信息，请参阅 [API Gateway 中 REST API 的映射模板转换](models-mappings.md)。*MIME 类型*的一个示例是 `application/json`。  | 

## x-amazon-apigateway-integration.responseTemplate 示例
<a name="api-gateway-swagger-extensions-response-template-example"></a>

 下面的示例为 `application/json` 和 `application/xml` MIME 类型的请求负载设置了映射模板。

```
"responseTemplates" : {
    "application/json" : "#set ($root=$input.path('$')) { \"stage\": \"$root.name\", \"user-id\": \"$root.key\" }",
    "application/xml" : "#set ($root=$input.path('$')) <stage>$root.name</stage> "
}
```

