

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

# API Gateway 中 REST API 的整合
<a name="how-to-integration-settings"></a>

 設定 API 方法後，您必須整合它與後端的端點。後端端點也稱為整合端點，可以是 Lambda 函數、HTTP 網頁或服務 AWS 動作。

如同使用 API 方法一樣，API 整合有整合請求和整合回應。整合請求會封裝後端收到的 HTTP 請求。它可能會，也可能不會與用戶端提交的方法不同。整合回應是封裝後端傳回輸出的 HTTP 回應。

設定整合請求包括以下內容：設定如何將用戶端提交的方法請求傳送到後端；設定如何轉換請求資料，如有必要，轉換成整合請求資料；指定呼叫哪個 Lambda 函數、指定傳入請求要轉送到哪個 HTTP 伺服器，或指定要叫用的 AWS 服務動作。

設定只適用於非代理整合的整合回應，包括下列內容：設定如何將後端傳回的結果傳送到指定狀態碼的方法回應、設定如何將指定的整合回應參數轉換成預先設定的方法回應參數、以及設定如何根據指定的內文映射範本，將整合回應內文映射到方法回應內文。

以程式設計方式，整合請求由 [https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html](https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html) 資源封裝，而整合回應由 API Gateway 的 [https://docs.aws.amazon.com/apigateway/latest/api/API_IntegrationResponse.html](https://docs.aws.amazon.com/apigateway/latest/api/API_IntegrationResponse.html) 資源回應。

若要設定整合請求，您要建立 [https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html](https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html) 資源，並用它設定整合端點 URL。然後，設定 IAM 許可以存取後端，並指定映射以轉換傳入的請求資料，然後將它傳送到後端。若要設定非代理整合的整合回應，您要建立 [https://docs.aws.amazon.com/apigateway/latest/api/API_IntegrationResponse.html](https://docs.aws.amazon.com/apigateway/latest/api/API_IntegrationResponse.html) 資源，並用它設定其目標方法回應。然後，設定如何將後端輸出映射到方法回應。

**Topics**
+ [在 API Gateway 中設定整合請求](api-gateway-integration-settings-integration-request.md)
+ [在 API Gateway 中設定整合回應](api-gateway-integration-settings-integration-response.md)
+ [API Gateway 中 REST API 的 Lambda 整合](set-up-lambda-integrations.md)
+ [API Gateway 中 REST API 的 HTTP 整合](setup-http-integrations.md)
+ [在 API Gateway 中串流代理整合的整合回應](response-transfer-mode.md)
+ [API Gateway 中 REST API 的私有整合](private-integration.md)
+ [API Gateway 中 REST API 的模擬整合](how-to-mock-integration.md)