

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

# 使用 API，在 Amazon Connect Customer Profiles 驗證計算屬性值
<a name="customerprofiles-calculated-attributes-validating-values"></a>

有兩個 API，`GetCalculatedAttributeForProfile` 和 `ListCalculatedAttributesForProfile`，位於設定檔層級。
+ **GetCalculatedAttributeForProfile** - 為單一設定檔檢索單一計算屬性。
+ **ListCalculatedAttributesForProfile** - 擷取單一設定檔的計算屬性清單

使用有效的設定檔 ID，您應該會看到計算屬性的值：

**回應範例**

```
{   
    "CalculatedAttributeName": "_average_hold_time",
    "DisplayName": "Average hold time",
    "IsDataPartial": "true",
    "Value": "24144"
}
```

**IsDataPartial** - 此旗標表示尚未達到時間範圍 (30 天) 或物件計數，因此計算屬性仍在計算中。例如，如果您想要超過 30 天的平均值，則只有在 30 天後，`IsDataPartial` 欄位才會設定為 false。

## 擷取計算屬性的清單
<a name="calculated-attributes-validating-a-list-of-values"></a>

**使用 AWS CLI**

```
aws customer-profiles list-calculated-attributes-for-profile --region {{your-region}} --domain-name {{your-domain-name}} --profile-id {{your-profile-id}}
```

**將 AWS CLI 與自訂 JSON 檔案搭配使用**

使用下列內容建立檔案：

```
{
    "DomainName": "your-domain-name", 
    "ProfileId" "some-profile-id"
}
```

```
aws customer-profiles list-calculated-attributes-for-profile --region {{your-region}} --cli-input-json file://{{list_calculated_attributes_for_profile_cli}}.json
```

**端點：**

```
https://profile.{{your-region}}.amazonaws.com/domains/{{your-domain-name}}/profile/{{your-profile-id}}/calculated-attributes/
```

## 擷取單一已計算屬性
<a name="calculated-attributes-validating-a-single-value"></a>

**使用 AWS CLI**：

```
aws customer-profiles get-calculated-attributes-for-profile --region {{your-region}} --domain-name {{your-domain-name}} --calculated-attribute-name {{your-calculated-attribute-name}} --profile-id {{your-profile-id}}
```

**使用 AWS CLI 搭配自訂 JSON 檔案**：

使用下列內容建立檔案：

```
{   
    "DomainName": "your-domain-name", 
    "CalculatedAttributeName": "your-calculated-attribute-name",
    "ProfileId" "your-profile-id"
}
```

```
aws customer-profiles get-calculated-attributes-for-profile --region {{your-region}} --cli-input-json file://{{list_calculated_attributes_for_profile_cli}}.json
```

**端點：**

```
https://profile.{{your-region}}.amazonaws.com/domains/{{your-domain-name}}/profile/{{your-profile-id}}/calculated-attributes/{{your-calculated-attribute-name}}
```