

# 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. [ゲートウェイレスポンス](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` プロパティを指定します。