x-amazon-apigateway-integration。 responseTemplates 物件 - Amazon API 网关

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

x-amazon-apigateway-integration。 responseTemplates 物件

指定指定MIME類型之回應裝載的對應範本。

屬性名稱 類型 描述
MIME type string

指定映射模板,以將整合響應主體轉換為給定MIME類型的方法響應主體。如需建立映射範本的相關資訊,請參閱PetStore 對映樣板。的一個例子 MIME typeapplication/json

x-amazon-apigateway-integration。 responseTemplate 例子

下列範例會為application/jsonapplication/xmlMIME類型的要求裝載設定對應範本。

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