

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

# 使用 API Gateway REST API 設定閘道回應
<a name="set-up-gateway-response-using-the-api"></a>

 使用 API Gateway REST API 自訂閘道回應之前，您必須已建立 API 並已取得其識別符。若要擷取 API 識別符，您可以遵循 [restapi:gateway-responses](https://docs.aws.amazon.com/apigateway/latest/api/API_GetGatewayResponses.html) 連結關係並查看結果。

**使用 API Gateway REST API 自訂閘道回應**

1. 若要覆寫整個 [GatewayResponse](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html) 執行個體，請呼叫 [gatewayresponse:put](https://docs.aws.amazon.com/apigateway/latest/api/API_PutGatewayResponse.html) 動作。在 URL 路徑參數中指定所需的 [responseType](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html#responseType)，並在請求酬載中提供 [statusCode](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html#statusCode)、[responseParameters](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html#responseParameters) 及 [responseTemplates](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html#responseTemplates) 映射。

1. 若要更新 `GatewayResponse` 執行個體的一部分，請呼叫 [gatewayresponse:update](https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateGatewayResponse.html) 動作。在 URL 路徑參數中指定所需的 `responseType`，並在請求承載中提供您需要的個別 `GatewayResponse` 屬性，例如 `responseParameters` 或 `responseTemplates` 映射。