

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

# GetAccountInformation
<a name="API_GetAccountInformation"></a>

擷取指定帳戶的相關資訊，包括其帳戶名稱、帳戶 ID 和帳戶建立日期和時間。若要使用此 API，IAM 使用者或角色必須具有 IAM `account:GetAccountInformation` 許可。

## 請求語法
<a name="API_GetAccountInformation_RequestSyntax"></a>

```
POST /getAccountInformation HTTP/1.1
Content-type: application/json

{
   "AccountId": "string"
}
```

## URI 請求參數
<a name="API_GetAccountInformation_RequestParameters"></a>

請求不會使用任何 URI 參數。

## 請求主體
<a name="API_GetAccountInformation_RequestBody"></a>

請求接受採用 JSON 格式的下列資料。

 ** [AccountId](#API_GetAccountInformation_RequestSyntax) **   <a name="accounts-GetAccountInformation-request-AccountId"></a>
指定您要使用此操作存取或修改之帳戶的 12 位數 AWS 帳戶 ID 號碼。  
如果您未指定此參數，它會預設為用來呼叫 操作的身分 AWS 帳戶。  
若要使用此參數，發起人必須是[組織管理帳戶](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account)或委派管理員帳戶中的身分，且指定的帳戶 ID 必須是同一組織中的成員帳戶。組織必須[啟用所有功能](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html)，且組織必須針對帳戶管理服務啟用[受信任存取](https://docs.aws.amazon.com/organizations/latest/userguide/services-that-can-integrate-account.html)，並可選擇指派[委派管理員](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#delegated-admin)帳戶。  
管理帳戶無法指定自己的 `AccountId`；它必須藉由不包含 `AccountId` 參數，在獨立內容中呼叫 操作。
若要在非組織成員的帳戶上呼叫此操作，請不要指定此參數，並使用屬於您想要擷取或修改其聯絡人之帳戶的身分來呼叫操作。  
類型：字串  
模式：`\d{12}`  
必要：否

## 回應語法
<a name="API_GetAccountInformation_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "AccountCreatedDate": "string",
   "AccountId": "string",
   "AccountName": "string"
}
```

## 回應元素
<a name="API_GetAccountInformation_ResponseElements"></a>

如果動作成功，則服務傳回 HTTP 200 回應。

服務會傳回下列 JSON 格式的資料。

 ** [AccountCreatedDate](#API_GetAccountInformation_ResponseSyntax) **   <a name="accounts-GetAccountInformation-response-AccountCreatedDate"></a>
建立帳戶的日期和時間。  
類型：Timestamp

 ** [AccountId](#API_GetAccountInformation_ResponseSyntax) **   <a name="accounts-GetAccountInformation-response-AccountId"></a>
指定您要透過此操作存取或修改之 AWS 帳戶 的 12 位數帳戶 ID 號碼。若要使用此參數，發起人必須是[組織管理帳戶](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account)或委派管理員帳戶中的身分。指定的帳戶 ID 必須是相同組織中的成員帳戶。組織必須[啟用所有功能](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html)，且組織必須針對帳戶管理服務啟用[受信任存取](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html)，並選擇性地指派[委派的管理員](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#delegated-admin)帳戶。  
此操作只能從成員帳戶的管理帳戶或組織的委派管理員帳戶呼叫。  
管理帳戶無法指定自己的 `AccountId`。
類型：字串  
模式：`\d{12}`

 ** [AccountName](#API_GetAccountInformation_ResponseSyntax) **   <a name="accounts-GetAccountInformation-response-AccountName"></a>
帳戶的名稱。  
類型：字串  
長度限制：長度下限為 1。長度上限為 50。  
模式：`[ -;=?-~]+`

## 錯誤
<a name="API_GetAccountInformation_Errors"></a>

如需所有動作常見錯誤的資訊，請參閱[常見錯誤類型](CommonErrors.md)。

 ** AccessDeniedException **   
操作失敗，因為呼叫身分沒有所需的最低許可。    
 ** errorType **   
API Gateway 填入`x-amzn-ErrorType`回應標頭的值。
HTTP 狀態碼：403

 ** InternalServerException **   
由於 內部發生錯誤，操作失敗 AWS。稍後再次嘗試您的操作。    
 ** errorType **   
API Gateway 填入`x-amzn-ErrorType`回應標頭的值。
HTTP 狀態碼：500

 ** TooManyRequestsException **   
操作失敗，因為呼叫次數太頻繁且超過節流限制。    
 ** errorType **   
API Gateway 填入`x-amzn-ErrorType`回應標頭的值。
HTTP 狀態碼：429

 ** ValidationException **   
操作失敗，因為其中一個輸入參數無效。    
 ** fieldList **   
偵測到無效項目的欄位。  
 ** message **   
通知您有關請求無效內容的訊息。  
 ** reason **   
驗證失敗的原因。
HTTP 狀態碼：400

## 範例
<a name="API_GetAccountInformation_Examples"></a>

### 範例 1
<a name="API_GetAccountInformation_Example_1"></a>

下列範例會擷取登入資料用於呼叫 操作之帳戶的 帳戶資訊。

#### 請求範例
<a name="API_GetAccountInformation_Example_1_Request"></a>

```
POST / HTTP/1.1
X-Amz-Target: AWSAccountV20210201.GetAccountInformation
                    
{}
```

#### 回應範例
<a name="API_GetAccountInformation_Example_1_Response"></a>

```
HTTP/1.1 200 OK
Content-Type: application/json
                    
{
   "AccountId": "123456789012",
   "AccountName": "MyAccount",
   "AccountCreatedDate": "2020-11-30T17:44:37Z"
}
```

### 範例 2
<a name="API_GetAccountInformation_Example_2"></a>

下列範例會擷取組織中指定成員帳戶的帳戶資訊。您必須使用來自組織管理帳戶的登入資料，或來自帳戶管理服務的委派管理員帳戶。

#### 請求範例
<a name="API_GetAccountInformation_Example_2_Request"></a>

```
POST / HTTP/1.1
X-Amz-Target: AWSAccountV20210201.GetAccountInformation
                    
{
   "AccountId": "123456789012" 
}
```

#### 回應範例
<a name="API_GetAccountInformation_Example_2_Response"></a>

```
HTTP/1.1 200 OK
Content-Type: application/json
                    
{
   "AccountId": "123456789012",
   "AccountName": "MyMemberAccount",
   "AccountCreatedDate": "2020-11-30T17:44:37Z"
}
```

## 另請參閱
<a name="API_GetAccountInformation_SeeAlso"></a>

如需在其中一種語言特定 AWS SDKs 中使用此 API 的詳細資訊，請參閱下列內容：
+  [AWS 命令列界面 V2](https://docs.aws.amazon.com/goto/cli2/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 .NET V4 的 SDK](https://docs.aws.amazon.com/goto/DotNetSDKV4/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 C\$1\$1 的 SDK](https://docs.aws.amazon.com/goto/SdkForCpp/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 Go 的 SDK v2](https://docs.aws.amazon.com/goto/SdkForGoV2/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 Java V2 的 SDK](https://docs.aws.amazon.com/goto/SdkForJavaV2/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 JavaScript V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 Kotlin 的 SDK](https://docs.aws.amazon.com/goto/SdkForKotlin/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 PHP V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForPHPV3/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 Python 的 SDK](https://docs.aws.amazon.com/goto/boto3/account-2021-02-01/GetAccountInformation) 
+  [AWS 適用於 Ruby V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/account-2021-02-01/GetAccountInformation) 