

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

# Amazon RDS API 參考
<a name="ProgrammingGuide"></a>

除了 AWS 管理主控台 和 AWS Command Line Interface (AWS CLI) 之外，Amazon RDS 還提供一個 API。您可以使用 API，將管理資料庫執行個體以及 Amazon RDS 中其他物件的任務自動化。
+ 如需依字母排序的 API 操作清單，請參閱[動作](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Operations.html)。
+ 如需依字母排序的資料類型清單，請參閱[資料類型](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Types.html)。
+ 如需常用查詢參數的清單，請參閱[常用參數](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonParameters.html)。
+ 如需錯誤碼的說明，請參閱[常見錯誤](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonErrors.html)。

如需 AWS CLI 的詳細資訊，請參閱 [Amazon RDS 的 AWS Command Line Interface 參考](https://docs.aws.amazon.com/cli/latest/reference/rds/index.html)。

**Topics**
+ [

# 使用查詢 API
](Using_the_Query_API.md)
+ [

# 對 Amazon RDS 上的應用程式進行故障診斷
](APITroubleshooting.md)

# 使用查詢 API
<a name="Using_the_Query_API"></a>

下節討論與查詢 API 搭配使用的參數和請求身分驗證。

如需查詢 API 運作方式的一般資訊，請參閱《Amazon EC2 API Reference》**中的[查詢請求](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html)。

## 查詢參數
<a name="query-parameters"></a>

HTTP 查詢型請求是使用 HTTP 動詞 GET 或 POST，以及名為 `Action` 之查詢參數的 HTTP 請求。

每一個查詢請求都須包括一些常用參數，來處理動作的身分驗證和選取。

部分操作有數個參數清單。這些清單是使用 `param.n` 表示法來指定的。*n* 的值是從 1 開始的整數。

如需 Amazon RDS​ 區域和端點的相關資訊，請參閱 *Amazon Web Services 一般參考* 中「區域與端點」一節的 [Amazon Relational Database Service​ (RDS)](https://docs.aws.amazon.com/general/latest/gr/rande.html#rds_region)。

## 查詢請求身分驗證
<a name="query-authentication"></a>

您只能透過 HTTPS 傳送查詢請求，而且必須在每一個查詢請求中包括一個簽章。您必須使用 AWS 簽章第 4 版或簽章第 2 版。如需詳細資訊，請參閱[簽章第 4 版簽署程序](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)和[簽章第 2 版簽署程序](https://docs.aws.amazon.com/general/latest/gr/signature-version-2.html)。

# 對 Amazon RDS 上的應用程式進行故障診斷
<a name="APITroubleshooting"></a>

Amazon RDS 會提供特定和描述性錯誤，以協助您在與 Amazon RDS API 互動時進行故障診斷。

**Topics**
+ [

## 擷取錯誤
](#RetrievingErrors)
+ [

## 對秘訣進行故障診斷
](#TroubleshootingTipss)

 如需 Amazon RDS 資料庫執行個體疑難排解的資訊，請參閱 [Amazon RDS 故障診斷](CHAP_Troubleshooting.md)。

## 擷取錯誤
<a name="RetrievingErrors"></a>

通常，您想要應用程式在您花費任何時間處理結果之前，先檢查請求是否已產生錯誤。若要了解系統是否發生錯誤，最簡單的方式即為在 Amazon RDS API 的回應中，尋找 `Error`​ 節點。

XPath 語法提供簡單的方式，來搜尋 `Error` 節點是否存在。它還提供了一種相對簡單的方式，來擷取錯誤碼和訊息。下列程式碼片段使用 Perl 和 XML::XPath 模組，來判斷請求期間是否發生錯誤。如果發生錯誤，程式碼會列印回應中的第一個錯誤碼和訊息。

```
use XML::XPath; 
    my $xp = XML::XPath->new(xml =>$response); 
    if ( $xp->find("//Error") ) 
    {print "There was an error processing your request:\n", " Error code: ",
    $xp->findvalue("//Error[1]/Code"), "\n", " ",
    $xp->findvalue("//Error[1]/Message"), "\n\n"; }
```

## 對秘訣進行故障診斷
<a name="TroubleshootingTipss"></a>

 我們建議以下列程序，來診斷並解決 Amazon RDS API 發生的問題。
+ 檢查 [http://status.aws.amazon.com](https://status.aws.amazon.com/)，驗證 Amazon RDS 在目標 AWS 區域中是否能正常運作。
+ 檢查請求的結構。

  在 *Amazon RDS API 參考中*，每項 Amazon RDS​ 操作都會有一個參考頁面。再次檢查您是否正確使用參數。如需有關可能出錯的概念，請查看範例請求或使用者案例，來查看那些範例是否執行類似操作。
+ 檢查 AWS re:Post。

  Amazon RDS 具有開發社群，您可在其中搜尋其他人在過程中所遇到問題的解決方案。如要檢視主題，請移至 [AWS re:Post](https://repost.aws/)。