使用API啟用資料集以進行設定檔更新

本教學課程涵蓋啟用具有「更新」功能的資料集以更新即時客戶個人檔案資料的程式。 這包括建立新資料集和設定現有資料集的步驟。

注意

更新工作流程只適用於批次內嵌。 串流內嵌是 not 支援。

快速入門

本教學課程需要妥善了解管理啟用設定檔的資料集時涉及的數個Adobe Experience Platform服務。 開始本教學課程之前,請檢閱這些相關檔案 Platform 服務:

  • Real-Time Customer Profile:根據來自多個來源的匯總資料,提供統一的即時消費者設定檔。
  • Catalog Service:RESTful API可讓您建立資料集,並針對 Real-Time Customer Profile 和 Identity Service.
  • Experience Data Model (XDM):標準化框架 Platform 組織客戶體驗資料。
  • 批次內嵌:批次內嵌API可讓您將資料以批次檔案的形式內嵌至Experience Platform。

以下小節提供您需要了解的其他資訊,以便成功呼叫Platform API。

讀取範例API呼叫

本教學課程提供範例API呼叫,以示範如何設定要求格式。 這些功能包括路徑、必要標題和格式正確的請求裝載。 也提供API回應中傳回的範例JSON。 如需範例API呼叫檔案中所使用慣例的相關資訊,請參閱 如何閱讀API呼叫範例 在 Experience Platform 疑難排解指南。

收集必要標題的值

若要對 Platform API,您必須先完成 驗證教學課程. 完成驗證教學課程會提供所有 Experience Platform API呼叫,如下所示:

  • Authorization: Bearer {ACCESS_TOKEN}
  • x-api-key: {API_KEY}
  • x-gw-ims-org-id: {ORG_ID}

所有包含裝載(POST、PUT、PATCH)的請求都需要額外的 Content-Type 頁首。 如有需要,此標題的正確值會顯示在範例要求中。

中的所有資源 Experience Platform 與特定虛擬沙箱隔離。 所有請求 Platform API需要 x-sandbox-name 用於指定操作將進行的沙箱名稱的標頭。 如需中沙箱的詳細資訊,請參閱 Platform,請參閱 沙箱概述檔案.

建立已啟用設定檔更新的資料集

建立新資料集時,您可以為「設定檔」啟用該資料集,並在建立時啟用更新功能。

注意

若要建立啟用設定檔的新資料集,您必須知道已啟用設定檔的現有XDM結構的ID。 如需如何查詢或建立已啟用設定檔的結構的詳細資訊,請參閱 使用方案註冊表API建立結構.

若要建立已啟用「設定檔」和更新的資料集,請使用POST請求 /dataSets 端點。

API格式

POST /dataSets

要求

unifiedIdentityunifiedProfiletags 在請求內文中,資料集將啟用 Profile 建立時。 在 unifiedProfile 陣列,添加 isUpsert:true 將新增資料集支援更新的功能。

curl -X POST \
  https://platform.adobe.io/data/foundation/catalog/dataSets \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -d '{
        "name": "Sample dataset",
        "description: "A sample dataset with a sample description.",
        "fields": [],
        "schemaRef": {
            "id": "https://ns.adobe.com/{TENANT_ID}/schemas/31670881463308a46f7d2cb09762715",
            "contentType": "application/vnd.adobe.xed-full-notext+json; version=1"
        },
        "tags": {
            "unifiedIdentity": [
                "enabled: true"
            ],
            "unifiedProfile": [
                "enabled: true",
                "isUpsert: true"
            ]
        }
      }'
屬性 說明
schemaRef.id 的ID Profile — 啟用資料集的基礎架構。
{TENANT_ID} 中的命名空間 Schema Registry 其中包含您組織的資源。 請參閱 TENANT_ID 區段 Schema Registry 開發人員指南,以取得詳細資訊。

回應

成功的回應會以下列形式顯示包含新建立資料集ID的陣列: "@/dataSets/{DATASET_ID}".

[
    "@/dataSets/5b020a27e7040801dedbf46e"
]

設定現有資料集

下列步驟說明如何設定現有已啟用設定檔的資料集,以便進行更新(更新)功能。

注意

若要設定現有的已啟用設定檔的資料集以進行更新,您必須先停用設定檔的資料集,然後在啟用資料集的同時重新啟用 isUpsert 標籤。 如果沒有為「設定檔」啟用現有資料集,您可以直接執行 啟用「設定檔」資料集並重新插入. 如果您不確定,下列步驟會示範如何檢查資料集是否已啟用。

檢查資料集是否已啟用設定檔

使用 Catalog API,您可以檢查現有的資料集,以判斷資料集是否已啟用並用於 Real-Time Customer Profile. 下列呼叫會依ID擷取資料集的詳細資訊。

API格式

GET /dataSets/{DATASET_ID}
參數 說明
{DATASET_ID} 您要檢查的資料集ID。

要求

curl -X GET 'https://platform.adobe.io/data/foundation/catalog/dataSets/5b020a27e7040801dedbf46e' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}'

回應

{
    "5b020a27e7040801dedbf46e": {
        "name": "{DATASET_NAME}",
        "imsOrg": "{ORG_ID}",
        "tags": {
            "adobe/pqs/table": [
                "unifiedprofileingestiontesteventsdataset"
            ],
            "unifiedIdentity": [
                "enabled:true"
            ],
            "unifiedProfile": [
                "enabled:true"
            ]
        },
        "lastBatchId": "{BATCH_ID}",
        "lastBatchStatus": "success",
        "dule": {},
        "statsCache": {
            "startDate": null,
            "endDate": null
        },
        "namespace": "ACP",
        "state": "DRAFT",
        "version": "1.0.1",
        "created": 1536536917382,
        "updated": 1539793978215,
        "createdClient": "{CLIENT_CREATED}",
        "createdUser": "{CREATED_BY}",
        "updatedUser": "{CREATED_BY}",
        "viewId": "{VIEW_ID}",
        "status": "enabled",
        "transforms": "@/dataSets/5b020a27e7040801dedbf46e/views/5b020a27e7040801dedbf46f/transforms",
        "files": "@/dataSets/5b020a27e7040801dedbf46e/views/5b020a27e7040801dedbf46f/files",
        "schema": "{SCHEMA}",
        "schemaMetadata": {
            "primaryKey": [],
            "delta": [],
            "dule": []
        },
        "schemaRef": {
            "id": "https://ns.adobe.com/xdm/context/experienceevent",
            "contentType": "application/vnd.adobe.xed+json"
        }
    }
}

tags 屬性,您可以看到 unifiedProfile 值存在 enabled:true. 因此, Real-Time Customer Profile 已針對此資料集啟用。

停用設定檔的資料集

若要設定啟用設定檔的資料集以進行更新,您必須先停用 unifiedProfileunifiedIdentity 標籤,然後在 isUpsert 標籤。 這是使用兩個PATCH請求來完成,一個是停用,另一個是重新啟用。

警告

停用時擷取至資料集的資料不會擷取至設定檔存放區。 在重新啟用設定檔之前,您應避免將資料擷取至資料集。

API格式

PATCH /dataSets/{DATASET_ID}
參數 說明
{DATASET_ID} 您要更新的資料集ID。

要求

第一PATCH請求內文包含 path to unifiedProfilepath to unifiedIdentity,設定 value to enabled:false 來停用標籤。

curl -X PATCH https://platform.adobe.io/data/foundation/catalog/dataSets/5b020a27e7040801dedbf46e \
  -H 'Content-Type:application/json-patch+json' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -d '[
        {
            "op": "replace",
            "path": "/tags/unifiedProfile",
            "value": ["enabled:false"]
        },
        {
            "op": "replace",
            "path": "/tags/unifiedIdentity",
            "value": ["enabled:false"]
        }
      ]'

回應

成功的PATCH要求會傳回HTTP狀態200(確定),以及包含更新資料集ID的陣列。 此ID應符合PATCH請求中傳送的ID。 此 unifiedProfileunifiedIdentity 標籤現已停用。

[
    "@/dataSets/5b020a27e7040801dedbf46e"
]

啟用設定檔資料集並重新插入

現有資料集可使用單一PATCH請求來啟用設定檔和屬性更新。

重要

為「設定檔」啟用資料集時,請確定資料集關聯的結構為 an 已啟用設定檔。 如果結構未啟用設定檔,資料集將 not 在Platform UI中顯示為已啟用設定檔。

API格式

PATCH /dataSets/{DATASET_ID}
參數 說明
{DATASET_ID} 您要更新的資料集ID。

要求

請求內文包含 path to unifiedProfile 設定 value 包括 enabledisUpsert 標籤,都設為 truepath to unifiedIdentity 設定 value 包括 enabled 標籤設為 true.

curl -X PATCH https://platform.adobe.io/data/foundation/catalog/dataSets/5b020a27e7040801dedbf46e \
  -H 'Content-Type:application/json-patch+json' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {ORG_ID}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -d '[
        {
            "op": "add",
            "path": "/tags/unifiedProfile",
            "value": [
                "enabled:true",
                "isUpsert:true"
            ]
        },
        {
            "op": "add",
            "path": "/tags/unifiedIdentity",
            "value": [
                "enabled:true"
            ]
        }
      ]'

回應

成功的PATCH要求會傳回HTTP狀態200(確定),以及包含更新資料集ID的陣列。 此ID應符合PATCH請求中傳送的ID。 此 unifiedProfile 標籤和 unifiedIdentity 標籤現在已啟用,並已針對屬性更新進行設定。

[
    "@/dataSets/5b020a27e7040801dedbf46e"
]

後續步驟

您的設定檔和已啟用更新的資料集現在可透過批次擷取工作流程來更新設定檔資料。 若要進一步了解將資料擷取至Adobe Experience Platform,請先閱讀 資料擷取概觀.

本頁內容