联合(或联合视图)是系统生成的只读架构,它聚合了共享相同类(XDM ExperienceEvent 或 XDM Individual Profile)并已启用 Real-Time Customer Profile.
本文档介绍了在架构注册表API中使用合并的基本概念,包括各种操作的示例调用。 有关XDM中合并的更多常规信息,请参阅 模式组合基础.
此 Schema Registry 在合并架构中自动包含三个键字段: identityMap
, timeSeriesEvents
、和 segmentMembership
.
合并模式的 identityMap
是联合关联记录架构中已知身份的表示形式。 标识映射将标识分隔为命名空间键控的不同数组。 每个列出的标识本身都是包含唯一标识的对象 id
值。 请参阅 Identity Service文档 以了解更多信息。
此 timeSeriesEvents
数组是与合并关联的记录架构相关的时间系列事件列表。 配置文件数据导出到数据集时,每个记录都包含此数组。 这在各种用例中非常有用,例如机器学习,在这些用例中,模型需要用户档案的整个行为历史记录及其记录属性。
此 segmentMembership
map存储区段定义的评估结果。 使用成功运行区段作业时 分段API,则映射将更新。 segmentMembership
还存储提取到Platform中的任何预评估受众,以便与其他解决方案(如Adobe Audience Manager)集成。 请参阅上的教程 使用API创建受众 以了解更多信息。
当您设置 union
标记时,将 Schema Registry 自动将架构添加到架构所基于的类的并集。 如果相关类不存在并集,则会自动创建新并集。 此 $id
因为联合类似于标准 $id
其他 Schema Registry 资源,唯一的区别是在后面附加两个下划线和单词“union”(__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
以及(取决于“接受”标头)合并的部分或全部详细信息。
合并查找可使用 /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 | 描述 |
---|---|
application/vnd.adobe.xed+json; version=1 |
原始 $ref 和 allOf . 包括标题和描述。 |
application/vnd.adobe.xed-full+json; version=1 |
$ref 属性和 allOf 已解决。 包括标题和描述。 |
响应
成功的响应将返回实现类的所有架构的合并视图,这些类 $id
在请求路径中提供。
响应格式取决于请求中发送的“接受”标头。 试验不同的“接受”标头,比较响应并确定哪个标头最适合您的用例。
{
"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"
}
}
}