

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

# 在 REST API 與 HTTP API 之間選擇
<a name="http-api-vs-rest"></a>

REST API 和 HTTP API 都是 RESTful API 產品。REST API 支援比 HTTP API 更多的功能，而 HTTP API 的設計具有最少功能，因此它們能以較低的價格提供。如果您需要 API 金鑰、個別用戶端限制、請求驗證、 AWS WAF 整合或私有 API 端點等功能，請選擇 REST API。如果您不需要 REST API 中包含的功能，請選擇 HTTP API。

下節摘要說明REST API 和 HTTP API 中可用的核心功能。必要時會提供其他連結，以在《API Gateway 開發人員指南》的 REST API 和 HTTP API 章節之間導覽。

## 端點類型
<a name="http-api-vs-rest.differences.endpoint-type"></a>

端點類型是指 API Gateway 為您的 API 建立的端點。如需詳細資訊，請參閱[API Gateway 中 REST API 的 API 端點類型](api-gateway-api-endpoint-types.md)。


| 端點類型 | REST API | HTTP API | 
| --- | --- | --- | 
|  [邊緣最佳化](api-gateway-api-endpoint-types.md#api-gateway-api-endpoint-types-edge-optimized)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [區域性](api-gateway-api-endpoint-types.md#api-gateway-api-endpoint-types-regional)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | 
|  [私有](api-gateway-api-endpoint-types.md#api-gateway-api-endpoint-types-private)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 

## 安全
<a name="http-api-vs-rest.differences.security"></a>

API Gateway 提供多種方法來保護 API 免於遭受特定威脅，例如惡意行為者或流量高峰。如需了解詳細資訊，請參閱 [在 API Gateway 中保護您的 REST API](rest-api-protect.md) 和 [在 API Gateway 中保護您的 HTTP API](http-api-protect.md)。


| 安全性功能 | REST API | HTTP API | 
| --- | --- | --- | 
|  [交互 TLS 驗證](rest-api-mutual-tls.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](rest-api-mutual-tls.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-mutual-tls.md)  | 
|  [後端身分驗證的憑證](getting-started-client-side-ssl-authentication.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [AWS WAF](apigateway-control-access-aws-waf.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 

## Authorization
<a name="http-api-vs-rest.differences.authorization"></a>

API Gateway 支援多種機制來控制和管理 API 的存取。如需詳細資訊，請參閱[在 API Gateway 中控制和管理對 REST API 的存取](apigateway-control-access-to-api.md)及[在 API Gateway 中控制和管理對 HTTP API 的存取](http-api-access-control.md)。


| 授權選項 | REST API | HTTP API | 
| --- | --- | --- | 
|  [IAM](permissions.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](permissions.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-access-control-iam.md)  | 
|  [資源政策](apigateway-resource-policies.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否   | 
|  [Amazon Cognito](apigateway-integrate-with-cognito.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是 1  | 
|  [使用 AWS Lambda 函數的自訂授權](apigateway-use-lambda-authorizer.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](apigateway-use-lambda-authorizer.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-lambda-authorizer.md)  | 
|  [JSON Web Token (JWT)](http-api-jwt-authorizer.md) 2  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | 

1您可以搭配 [JWT 授權器](http-api-jwt-authorizer.md)使用 Amazon Cognito。

2您可以使用[Lambda 授權器](apigateway-use-lambda-authorizer.md)來驗證 REST API 的 JWT。

## API 管理
<a name="http-api-vs-rest.differences.management"></a>

如果您需要 API 管理功能 (例如 API 金鑰和個別用戶端速率限制)，請選擇 REST API。如需詳細資訊，請參閱[將您的 REST API 分發至 API Gateway 中的用戶端](rest-api-distribute.md)、[API Gateway 中公有 REST API 的自訂網域名稱](how-to-custom-domains.md)及[API Gateway 中 HTTP API 的自訂網域名稱](http-api-custom-domain-names.md)。


| 功能 | REST API | HTTP API | 
| --- | --- | --- | 
|  [自訂網域](how-to-custom-domains.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](how-to-custom-domains.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-custom-domain-names.md)  | 
|  [API 金鑰](api-gateway-api-usage-plans.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [個別用戶端速率限制](api-gateway-request-throttling.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [個別用戶端使用量限制](api-gateway-api-usage-plans.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [開發人員入口網站](apigateway-portals.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 

## 開發
<a name="http-api-vs-rest.differences.development"></a>

在開發 API Gateway API 時，您可以決定 API 的許多特性。這些特性取決於 API 的使用案例。如需詳細資訊，請參閱 [在 APIs Gateway 中開發 REST API](rest-api-develop.md) 及 [在 API Gateway 中開發 HTTP API](http-api-develop.md)。


| 功能 | REST API | HTTP API | 
| --- | --- | --- | 
|  [CORS 組態](how-to-cors.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](how-to-cors.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-cors.md)  | 
|  [測試叫用](how-to-test-method.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [快取](api-gateway-caching.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [使用者控制的部署](how-to-deploy-api.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](how-to-deploy-api.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-stages.md)  | 
|  [自動部署](http-api-stages.md)  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | 
|  [自訂閘道回應](api-gateway-gatewayResponse-definition.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [Canary 版本部署](canary-release.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [請求驗證](api-gateway-method-request-validation.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [請求參數轉換](rest-api-data-transformations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](rest-api-data-transformations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-parameter-mapping.md)  | 
|  [請求主體轉換](rest-api-data-transformations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 

## 監控
<a name="http-api-vs-rest.differences.monitoring"></a>

API Gateway 支援多個選項來記錄 API 請求和監控 API。如需詳細資訊，請參閱[在 API Gateway 中監控 REST API](rest-api-monitor.md)及[在 API Gateway 中監控 HTTP API](http-api-monitor.md)。


| 功能 | REST API | HTTP API | 
| --- | --- | --- | 
|  [Amazon CloudWatch 指標](monitoring-cloudwatch.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](monitoring-cloudwatch.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-metrics.md)  | 
|  [CloudWatch Logs 的存取日誌](set-up-logging.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](set-up-logging.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-logging.md)  | 
|  [Amazon Data Firehose 的存取日誌](apigateway-logging-to-kinesis.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [執行日誌](set-up-logging.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [AWS X-Ray 追蹤](apigateway-xray.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 

## 整合
<a name="http-api-vs-rest.differences.integrations"></a>

將 API Gateway API 連接到後端資源的各項整合。如需詳細資訊，請參閱[API Gateway 中 REST API 的整合](how-to-integration-settings.md)及[在 API Gateway 中建立 HTTP API 的整合](http-api-develop-integrations.md)。


| 功能 | REST API | HTTP API | 
| --- | --- | --- | 
|  [公有 HTTP 端點](setup-http-integrations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](setup-http-integrations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-develop-integrations-http.md)  | 
|  [AWS 服務](api-gateway-api-integration-types.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](api-gateway-api-integration-types.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-develop-integrations-aws-services.md)  | 
|  [AWS Lambda 函數](set-up-lambda-integrations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](set-up-lambda-integrations.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-develop-integrations-lambda.md)  | 
|  [與 Network Load Balancer 的私有整合](set-up-private-integration.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](set-up-private-integration.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](http-api-develop-integrations-private.md)  | 
|  [與 Application Load Balancer 的私有整合](http-api-develop-integrations-private.md)  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) [是](set-up-private-integration.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | 
|  [與 的私有整合 AWS Cloud Map](http-api-develop-integrations-private.md)  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否   |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | 
|  [模擬整合](how-to-mock-integration.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 
|  [回應串流](response-transfer-mode.md)  |  ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/success_icon.svg) 是  | ![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/apigateway/latest/developerguide/images/negative_icon.svg) 否  | 