x-amazon-apigateway-integration.responseTemplates 对象 - Amazon API Gateway
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

x-amazon-apigateway-integration.responseTemplates 对象

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

属性
属性名称 类型 说明
MIME type string

指定映射模板,将集成响应正文转换为给定 MIME 类型的方法响应正文。有关创建映射模板的信息,请参阅 PetStore 映射模板MIME 类型的一个示例是 application/json

x-amazon-apigateway-integration.responseTemplate 示例

下面的示例为 application/jsonapplication/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> " }