x-amazon-apigateway-integration. responseTemplates 物件 - Amazon API Gateway

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

x-amazon-apigateway-integration. responseTemplates 物件

為指定 MIME 類型的回應承載指定對應範本。

屬性
屬性名稱 類型 描述
MIME type string

指定對應範本,將整合回應內文轉換成指定 MIME 類型的方法回應內文。如需建立映射範本的相關資訊,請參閱PetStore 對映樣板MIME 類型範例為 application/json

x-amazon-apigateway-integration. 回應範本範例

下列範例會為 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> " }