聯合(或聯合檢視)是系統產生的唯讀結構描述,可彙總共用相同類別(XDM ExperienceEvent 或 XDM Individual Profile)並啟用 Real-Time Customer Profile.
本文介紹在Schema Registry API中使用聯合的基本概念,包括各種操作的範例呼叫。 如需XDM中聯合的更多一般資訊,請參閱 結構描述組合的基本面.
此 Schema Registry 聯合結構描述中會自動包含三個索引鍵欄位: identityMap
, timeSeriesEvents
、和 segmentMembership
.
聯合結構的 identityMap
是聯合關聯記錄結構內已知身分的表示法。 身分對應會將身分割槽分給名稱空間輸入的不同陣列。 每個列出的身分識別本身都是包含唯一身分的物件 id
值。 請參閱 Identity Service檔案 以取得詳細資訊。
此 timeSeriesEvents
array是與聯集關聯的記錄結構描述相關的時間序列事件清單。 將設定檔資料匯出至資料集時,每個記錄都會包含此陣列。 這對於各種使用案例非常有用,例如機器學習,其中模型需要設定檔的整個行為歷史記錄及其記錄屬性。
此 segmentMembership
地圖會儲存評估區段定義的結果。 使用成功執行區段作業時 分段API,對應會更新。 segmentMembership
也會儲存擷取至Platform的任何預先評估對象,以允許與其他解決方案(例如Adobe Audience Manager)整合。 請參閱上的教學課程 使用API建立對象 以取得詳細資訊。
當您設定 union
標籤中, Schema Registry 自動將結構描述新增到結構描述所依據類別的聯合。 如果相關類別不存在聯集,則會自動建立新的聯集。 此 $id
(對於聯集)類似於標準 $id
其他 Schema Registry 資源,唯一的差異是在後面加上兩個底線和單字「聯合」(__union
)。
您可以透過向以下網站發出GET請求來檢視可用聯合的清單: /tenant/unions
端點。
API格式
GET /tenant/unions
要求
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/unions \
-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}' \
-H 'Accept: application/vnd.adobe.xed-id+json'
回應格式取決於 Accept
標頭已在請求中傳送。 下列專案 Accept
標題可用於列出聯合:
Accept 頁首 |
說明 |
---|---|
application/vnd.adobe.xed-id+json |
傳回每個資源的簡短摘要。 這是列出資源的建議標頭。 (上限: 300) |
application/vnd.adobe.xed+json |
傳回每個資源的完整JSON類別(含原始專案) $ref 和 allOf 包含。 (上限: 300) |
回應
成功的回應會傳回HTTP狀態200 (確定)及 results
陣列中。 如果已定義聯合,則每個聯合的詳細資訊會作為陣列中的物件提供。 如果尚未定義聯合,仍會傳回HTTP狀態200 (確定),但 results
陣列將是空的。
{
"results": [
{
"title": "XDM Individual Profile",
"$id": "https://ns.adobe.com/xdm/context/profile__union",
"meta:altId": "_xdm.context.profile__union",
"version": "1"
},
{
"title": "Property",
"$id": "https://ns.adobe.com/{TENANT_ID}/classes/19e1d8b5098a7a76e2c10a81cbc99590__union",
"meta:altId": "_{TENANT_ID}.classes.19e1d8b5098a7a76e2c10a81cbc99590__union",
"version": "1"
}
]
}
您可以透過執行包含的GET請求來檢視特定聯合 $id
以及(視Accept標題而定)聯合的部分或全部細節。
可使用下列方式使用聯集查詢: /unions
和 /schemas
端點以啟用它們以供在 Profile 匯出至資料集。
API格式
GET /tenant/unions/{UNION_ID}
GET /tenant/schemas/{UNION_ID}
參數 | 說明 |
---|---|
{UNION_ID} |
URL編碼 $id 您要查閱之聯合的URI。 聯合結構描述的URI會附加「__union」。 |
要求
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/unions/https%3A%2F%2Fns.adobe.com%2Fxdm%2Fcontext%2Fprofile__union \
-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}' \
-H 'Accept: application/vnd.adobe.xed+json; version=1'
聯合查詢請求需要 version
包含在Accept標題中。
下列Accept標頭可用於聯合結構描述查閱:
Accept | 說明 |
---|---|
application/vnd.adobe.xed+json; version=1 |
原始為 $ref 和 allOf . 包括標題和說明。 |
application/vnd.adobe.xed-full+json; version=1 |
$ref 屬性和 allOf 已解決。 包括標題和說明。 |
回應
成功的回應會傳回實作類別的所有結構描述的聯合檢視,這些類別的 $id
要求路徑中提供。
回應格式取決於請求中傳送的Accept標頭。 實驗不同的Accept標頭,以比較回應並判斷哪個標頭最適合您的使用案例。
{
"type": "object",
"description": "Union view of all schemas that extend https://ns.adobe.com/xdm/context/profile",
"allOf": [
{
"$ref": "https://ns.adobe.com/xdm/context/profile"
},
{
"$ref": "https://ns.adobe.com/xdm/context/profile-person-details"
},
{
"$ref": "https://ns.adobe.com/{TENANT_ID}/mixins/477bb01d7125b015b4feba7bccc2e599"
},
{
"$ref": "https://ns.adobe.com/xdm/context/profile-personal-details"
}
],
"meta:extends": [
"https://ns.adobe.com/xdm/context/profile",
"https://ns.adobe.com/xdm/data/record",
"https://ns.adobe.com/xdm/context/identitymap",
"https://ns.adobe.com/xdm/common/extensible",
"https://ns.adobe.com/xdm/common/auditable",
"https://ns.adobe.com/xdm/context/profile-person-details",
"https://ns.adobe.com/{TENANT_ID}/mixins/477bb01d7125b015b4feba7bccc2e599",
"https://ns.adobe.com/xdm/context/profile-personal-details"
],
"title": "Union object for https://ns.adobe.com/xdm/context/profile",
"$id": "https://ns.adobe.com/xdm/context/profile__union",
"meta:containerId": "tenant",
"meta:class": "https://ns.adobe.com/xdm/context/profile",
"meta:altId": "_xdm.context.profile__union",
"version": "1.0",
"meta:resourceType": "unions",
"meta:registryMetadata": {}
}
為了使結構描述包含在其類別的聯集內, union
標籤必須新增到結構描述的 meta:immutableTags
屬性。 您可以發出PATCH請求以新增 meta:immutableTags
陣列,單一字串值為 union
至有問題的結構描述。 請參閱 結構描述端點指南 以取得詳細範例。
GET若要檢視哪些結構描述是特定聯合的一部分,您可以對 /tenant/schemas
端點。 使用 property
查詢引數時,您可以將回應設定為只傳回包含 meta:immutableTags
欄位和 meta:class
等於您要存取其聯集的類別。
API格式
GET /tenant/schemas?property=meta:immutableTags==union&property=meta:class=={CLASS_ID}
參數 | 說明 |
---|---|
{CLASS_ID} |
此 $id 要列出其聯合啟用結構描述的類別。 |
要求
以下請求會擷取屬於聯集的所有結構描述清單 XDM Individual Profile 類別。
curl -X GET \
'https://platform.adobe.io/data/foundation/schemaregistry/tenant/schemas?property=meta:immutableTags==union&property=meta:class==https://ns.adobe.com/xdm/context/profile' \
-H 'Accept: application/vnd.adobe.xed-id+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}'
回應格式取決於 Accept
標頭已在請求中傳送。 下列專案 Accept
標頭可用於列出結構描述:
Accept 頁首 |
說明 |
---|---|
application/vnd.adobe.xed-id+json |
傳回每個資源的簡短摘要。 這是列出資源的建議標頭。 (上限: 300) |
application/vnd.adobe.xed+json |
傳回每個資源的完整JSON結構描述,包含原始檔案 $ref 和 allOf 包含。 (上限: 300) |
回應
成功的回應會傳回結構描述的篩選清單,其中只包含已針對聯合成員資格啟用的指定類別結構描述。 請記住,使用多個查詢引數時,會假設為AND關係。
{
"results": [
{
"title": "Schema 1",
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/142afb78d8b368a5ba97a6cc8fc7e033",
"meta:altId": "_{TENANT_ID}.schemas.142afb78d8b368a5ba97a6cc8fc7e033",
"version": "1.2"
},
{
"title": "Schema 2",
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/e7297a6ddfc7812ab3a7b504a1ab98da",
"meta:altId": "_{TENANT_ID}.schemas.e7297a6ddfc7812ab3a7b504a1ab98da",
"version": "1.5"
},
{
"title": "Schema 3",
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/50f960bb810e99a21737254866a477bf",
"meta:altId": "_{TENANT_ID}.schemas.50f960bb810e99a21737254866a477bf",
"version": "1.2"
},
{
"title": "Schema 4",
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/a39655ca8ea3d5c1f36a463b45fccca8",
"meta:altId": "_{TENANT_ID}.schemas.a39655ca8ea3d5c1f36a463b45fccca8",
"version": "1.1"
},
{
"title": "Schema 5",
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/c063fac45c6d6285ef33b0e2af09f633",
"meta:altId": "_{TENANT_ID}.schemas.c063fac45c6d6285ef33b0e2af09f633",
"version": "1.2"
},
{
"title": "Schema 6",
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/dfebb19b93827b70bbad006137812537",
"meta:altId": "_{TENANT_ID}.schemas.dfebb19b93827b70bbad006137812537",
"version": "1.7"
}
],
"_links": {
"global_schemas": {
"href": "https://platform.adobe.io/data/foundation/schemaregistry/global/schemas?property=meta:immutableTags==union&property=meta:class==https://ns.adobe.com/xdm/context/profile"
}
}
}