实体端点(配置文件访问)
Adobe Experience Platform允许您使用RESTful API或用户界面访问Real-Time Customer Profile数据。 本指南概述了如何使用API访问实体(通常称为“用户档案”)。 有关使用Platform UI访问配置文件的详细信息,请参阅配置文件用户指南。
快速入门
本指南中使用的API终结点是Real-Time Customer Profile API的一部分。 在继续之前,请查看快速入门指南,以获取相关文档的链接、此文档中示例API调用的阅读指南,以及有关成功调用任何Experience Platform API所需的所需标头的重要信息。
按身份访问配置文件数据
通过向/access/entities
端点发出GET请求并提供实体标识作为一系列查询参数,您可以访问Profile实体。 此身份包含ID值(entityId
)和身份命名空间(entityIdNS
)。
请求路径中提供的查询参数指定要访问的数据。 您可以包含多个参数,以&分隔。 附录的查询参数部分提供了有效参数的完整列表。
API格式
GET /access/entities?{QUERY_PARAMETERS}
请求
以下请求使用标识检索客户的电子邮件和名称:
curl -X GET \
'https://platform.adobe.io/data/core/ups/access/entities?schema.name=_xdm.context.profile&entityId=janedoe@example.com&entityIdNS=email&fields=identities,person.name,workEmail' \
-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}'
响应
{
"BVrqzwVv7o2p3naHvnsWpqZXv3KJgA": {
"entityId": "BVrqzwVv7o2p3naHvnsWpqZXv3KJgA",
"sources": [
"1000000000"
],
"entity": {
"identities": [
{
"id": "89149270342662559642753730269986316601",
"namespace": {
"code": "ecid"
}
},
{
"id": "janedoe@example.com",
"namespace": {
"code": "email"
}
},
{
"id": "janesmith@example.com",
"namespace": {
"code": "email"
}
},
{
"id": "89149270342662559642753730269986316604",
"namespace": {
"code": "ecid"
}
},
{
"id": "58832431024964181144308914570411162539",
"namespace": {
"code": "ecid"
}
},
{
"id": "89149270342662559642753730269986316602",
"namespace": {
"code": "ecid"
},
"primary": true
}
],
"person": {
"name": {
"firstName": "Jane",
"middleName": "F",
"lastName": "Doe"
}
},
"workEmail": {
"primary": true,
"address": "janedoe@example.com",
"label": "Jane Doe",
"type": "work",
"status": "active"
}
},
"lastModifiedAt": "2018-08-28T20:57:24Z"
}
}
按身份列表访问配置文件数据
您可以通过向/access/entities
端点发出POST请求并在有效负载中提供身份,按身份访问多个配置文件实体。 这些身份包含ID值(entityId
)和身份命名空间(entityIdNS
)。
API格式
POST /access/entities
请求
以下请求按标识列表检索多个客户的名称和电子邮件地址:
curl -X POST \
https://platform.adobe.io/data/core/ups/access/entities \
-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 '{
"schema":{
"name":"_xdm.context.profile"
},
"fields":[
"identities",
"person.name",
"workEmail"
],
"identities":[
{
"entityId":"89149270342662559642753730269986316601",
"entityIdNS":{
"code":"ECID"
}
},
{
"entityId":"89149270342662559642753730269986316900",
"entityIdNS":{
"code":"ECID"
}
},
{
"entityId":"89149270342662559642753730269986316602",
"entityIdNS":{
"code":"ECID"
}
}
],
"timeFilter": {
"startTime": 1539838505,
"endTime": 1539838510
},
"limit": 10,
"orderby": "-timestamp",
"withCA": true
}'
schema.name
fields
identities
identities.entityId
identities.entityIdNS.code
timeFilter.startTime
timeFilter.endTime
limit
orderby
(+/-)timestamp
,默认值为+timestamp
。withCA
响应
成功的响应将返回请求正文中指定的实体的请求字段。
{
"A29cgveD5y64ezlhxjUXNzcm": {
"entityId": "A29cgveD5y64ezlhxjUXNzcm",
"sources": [
"1000000000"
],
"entity": {
"identities": [
{
"id": "89149270342662559642753730269986316601",
"namespace": {
"code": "ecid"
}
},
{
"id": "janedoe@example.com",
"namespace": {
"code": "email"
}
},
{
"id": "05DD23564EC4607F0A490D44",
"namespace": {
"code": "ecid"
}
},
{
"id": "89149270342662559642753730269986316603",
"namespace": {
"code": "ecid"
}
},
{
"id": "janesmith@example.com",
"namespace": {
"code": "email"
}
},
{
"id": "89149270342662559642753730269986316604",
"namespace": {
"code": "ecid"
}
},
{
"id": "89149270342662559642753730269986316700",
"namespace": {
"code": "ecid"
}
},
{
"id": "89149270342662559642753730269986316701",
"namespace": {
"code": "ecid"
}
},
{
"id": "58832431024964181144308914570411162539",
"namespace": {
"code": "ecid"
}
},
{
"id": "89149270342662559642753730269986316602",
"namespace": {
"code": "ecid"
},
"primary": true
}
],
"person": {
"name": {
"firstName": "Jane",
"middleName": "F",
"lastName": "Doe"
}
},
"workEmail": {
"primary": true,
"address": "janedoe@example.com",
"label": "Jane Doe",
"type": "work",
"status": "active"
}
},
"lastModifiedAt": "2018-08-28T20:57:24Z"
},
"A29cgveD5y64e2RixjUXNzcm": {
"entityId": "A29cgveD5y64e2RixjUXNzcm",
"sources": [
""
],
"entity": {},
"lastModifiedAt": "1970-01-01T00:00:00Z"
},
"A29cgveD5y64ezphxjUXNzcm": {
"entityId": "A29cgveD5y64ezphxjUXNzcm",
"sources": [
"1000000000"
],
"entity": {
"identities": [
{
"id": "89149270342662559642753730269986316602",
"namespace": {
"code": "ecid"
},
"primary": true
},
{
"id": "janedoe@example.com",
"namespace": {
"code": "email"
}
}
],
"person": {
"name": {
"firstName": "Jane",
"middleName": "F",
"lastName": "Doe"
}
},
"workEmail": {
"primary": true,
"address": "janedoe@example.com",
"label": "Jane Doe",
"type": "work",
"status": "active"
}
},
"lastModifiedAt": "2018-08-27T23:25:52Z"
}
}
按身份访问用户档案的时间系列事件
通过向/access/entities
端点发出GET请求,您可以按其关联的配置文件实体的标识访问时间序列事件。 此身份包含ID值(entityId
)和身份命名空间(entityIdNS
)。
请求路径中提供的查询参数指定要访问的数据。 您可以包含多个参数,以&分隔。 附录的查询参数部分提供了有效参数的完整列表。
API格式
GET /access/entities?{QUERY_PARAMETERS}
请求
以下请求按ID查找配置文件实体,并检索与该实体关联的所有时间序列事件的属性endUserIDs
、web
和channel
的值。
curl -X GET \
'https://platform.adobe.io/data/core/ups/access/entities?schema.name=_xdm.context.experienceevent&relatedSchema.name=_xdm.context.profile&relatedEntityId=89149270342662559642753730269986316900&relatedEntityIdNS=ECID&fields=endUserIDs,web,channel&startTime=1531260476000&endTime=1531260480000&limit=1' \
-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}'
响应
成功的响应将返回在请求查询参数中指定的时间序列事件和相关字段的分页列表。
limit=1
)的限制,因此以下响应中的count
为1,并且只返回了一个实体。{
"_page": {
"orderby": "timestamp",
"start": "c8d11988-6b56-4571-a123-b6ce74236036",
"count": 1,
"next": "c8d11988-6b56-4571-a123-b6ce74236037"
},
"children": [
{
"relatedEntityId": "A29cgveD5y64e2RixjUXNzcm",
"entityId": "c8d11988-6b56-4571-a123-b6ce74236036",
"timestamp": 1531260476000,
"entity": {
"endUserIDs": {
"_experience": {
"ecid": {
"id": "89149270342662559642753730269986316900",
"namespace": {
"code": "ecid"
}
}
}
},
"channel": {
"_type": "web"
},
"web": {
"webPageDetails": {
"name": "Fernie Snow",
"pageViews": {
"value": 1
}
}
}
},
"lastModifiedAt": "2018-08-21T06:49:02Z"
}
],
"_links": {
"next": {
"href": "/entities?start=c8d11988-6b56-4571-a123-b6ce74236037&orderby=timestamp&schema.name=_xdm.context.experienceevent&relatedSchema.name=_xdm.context.profile&relatedEntityId=89149270342662559642753730269986316900&relatedEntityIdNS=ECID&fields=endUserIDs,web,channel&startTime=1531260476000&endTime=1531260480000&limit=1"
}
}
}
访问结果的后续页面
检索时序事件时,结果将分页。 如果有后续结果页,则_page.next
属性将包含ID。 此外,_links.next.href
属性还提供用于检索下一页的请求URI。 要检索结果,请对/access/entities
终结点发出另一个GET请求,但您必须确保使用提供的URI的值替换/entities
。
/entities/
。 它只应出现一次,如/access/entities?start=...
API格式
GET /access/{NEXT_URI}
{NEXT_URI}
_links.next.href
。请求
以下请求通过使用_links.next.href
URI作为请求路径来检索结果的下一页。
curl -X GET \
'https://platform.adobe.io/data/core/ups/access/entities?start=c8d11988-6b56-4571-a123-b6ce74236037&orderby=timestamp&schema.name=_xdm.context.experienceevent&relatedSchema.name=_xdm.context.profile&relatedEntityId=89149270342662559642753730269986316900&relatedEntityIdNS=ECID&fields=endUserIDs,web,channel&startTime=1531260476000&endTime=1531260480000&limit=1' \
-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}'
响应
成功的响应将返回结果的下一页。 此响应没有后续结果页,如_page.next
和_links.next.href
的空字符串值所指示。
{
"_page": {
"orderby": "timestamp",
"start": "c8d11988-6b56-4571-a123-b6ce74236037",
"count": 1,
"next": ""
},
"children": [
{
"relatedEntityId": "A29cgveD5y64e2RixjUXNzcm",
"entityId": "c8d11988-6b56-4571-a123-b6ce74236037",
"timestamp": 1531260477000,
"entity": {
"endUserIDs": {
"_experience": {
"ecid": {
"id": "89149270342662559642753730269986316900",
"namespace": {
"code": "ecid"
}
}
}
},
"channel": {
"_type": "web"
},
"web": {
"webPageDetails": {
"name": "Fernie Snow",
"pageViews": {
"value": 1
}
}
}
},
"lastModifiedAt": "2018-08-21T06:50:01Z"
}
],
"_links": {
"next": {
"href": ""
}
}
}
按身份访问多个配置文件的时间序列事件
通过向/access/entities
端点发出POST请求并在有效负载中提供配置文件标识,您可以从多个关联的配置文件访问时间序列事件。 这些标识每个都包含ID值(entityId
)和标识命名空间(entityIdNS
)。
API格式
POST /access/entities
请求
以下请求可检索与用户档案身份列表关联的时间系列事件的用户ID、本地时间和国家/地区代码:
curl -X POST \
https://platform.adobe.io/data/core/ups/access/entities \
-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 '{
"schema": {
"name": "_xdm.context.experienceevent"
},
"relatedSchema": {
"name": "_xdm.context.profile"
},
"identities": [
{
"relatedEntityId": "GkouAW-yD9aoRCPhRYROJ-TetAFW"
}
{
"relatedEntityId": "GkouAW-2u-7iWt5vQ9u2wm40JOZY"
}
],
"fields": [
"endUserIDs",
"placeContext.localTime",
"placeContext.geo.countryCode"
],
"timeFilter": {
"startTime": 11539838505
"endTime": 1539838510
},
"limit": 10
}'
schema.name
relatedSchema.name
schema.name
为_xdm.context.experienceevent
,该值必须为时间序列事件相关的配置文件实体指定架构。identities
fields
mergePolicyId
orderby
(+/-)timestamp
,默认值为+timestamp
。timeFilter.startTime
timeFilter.endTime
limit
withCA
响应
成功的响应将返回与请求中指定的多个配置文件关联的时间系列事件的分页列表。
{
"GkouAW-yD9aoRCPhRYROJ-TetAFW": {
"_page": {
"orderby": "timestamp",
"start": "ee0fa8eb-f09c-4d72-a432-fea7f189cfcd",
"count": 10,
"next": "40cb2fb3-78cd-49d3-806f-9bdb22748226"
},
"children": [
{
"relatedEntityId": "GkouAW-yD9aoRCPhRYROJ-TetAFW",
"entityId": "ee0fa8eb-f09c-4d72-a432-fea7f189cfcd",
"timestamp": 1537275882000,
"entity": {
"endUserIDs": {
"_experience": {
"mcid": {
"id": "67971860962043911970658021809222795905",
"namespace": {
"code": "ECID"
}
},
"aacustomid": {
"id": "50353446361742744826197433431642033796",
"namespace": {
"code": "CRMID"
},
"primary": true
},
"acid": {
"id": "2de32e9a00003314-2fd9c00000000026",
"namespace": {
"code": "AVID"
}
}
}
},
"placeContext": {
"localTime": "2018-09-18T13:04:42Z",
"geo": {
"countryCode": "MX"
}
}
},
"lastModifiedAt": "2018-10-24T17:35:01Z"
},
{
"relatedEntityId": "GkouAW-yD9aoRCPhRYROJ-TetAFW",
"entityId": "a9e137b4-1348-4878-8167-e308af523d8b",
"timestamp": 1537275889000,
"entity": {
"endUserIDs": {
"_experience": {
"mcid": {
"id": "67971860962043911970658021809222795905",
"namespace": {
"code": "ECID"
}
},
"aacustomid": {
"id": "50353446361742744826197433431642033796",
"namespace": {
"code": "CRMID"
},
"primary": true
},
"acid": {
"id": "2de32e9a00003314-2fd9c00000000026",
"namespace": {
"code": "AVID"
}
}
}
},
"placeContext": {
"localTime": "2018-09-18T13:04:49Z",
"geo": {
"countryCode": "MX"
}
}
},
"lastModifiedAt": "2018-10-24T17:35:01Z"
}
],
"_links": {
"next": {
"href": "/entities",
"payload": {
"schema": {
"name": "_xdm.context.experienceevent"
},
"relatedSchema": {
"name": "_xdm.context.profile"
},
"timeFilter": {
"startTime": 1537275882000
},
"fields": [
"endUserIDs",
"placeContext.localTime",
"placeContext.geo.countryCode"
],
"identities": [
{
"relatedEntityId": "GkouAW-yD9aoRCPhRYROJ-TetAFW",
"start": "40cb2fb3-78cd-49d3-806f-9bdb22748226"
}
],
"limit": 10
}
}
}
},
"GkouAW-2u-7iWt5vQ9u2wm40JOZY": {
"_page": {
"orderby": "timestamp",
"start": "2746d0db-fa64-4e29-b67e-324bec638816",
"count": 9,
"next": ""
},
"children": [
{
"relatedEntityId": "GkouAW-2u-7iWt5vQ9u2wm40JOZY",
"entityId": "2746d0db-fa64-4e29-b67e-324bec638816",
"timestamp": 1537559483000,
"entity": {
"endUserIDs": {
"_experience": {
"mcid": {
"id": "76436745599328540420034822220063618863",
"namespace": {
"code": "ECID"
}
},
"aacustomid": {
"id": "48593470048917738786405847327596263131",
"namespace": {
"code": "CRMID"
},
"primary": true
},
"acid": {
"id": "2de32e9a80007451-03da600000000028",
"namespace": {
"code": "AVID"
}
}
}
},
"placeContext": {
"localTime": "2018-09-21T19:51:23Z",
"geo": {
"countryCode": "US"
}
}
},
"lastModifiedAt": "2018-10-24T17:34:58Z"
},
{
"relatedEntityId": "GkouAW-2u-7iWt5vQ9u2wm40JOZY",
"entityId": "9bf337a1-3256-431e-a38c-5c0d42d121d1",
"timestamp": 1537559486000,
"entity": {
"endUserIDs": {
"_experience": {
"mcid": {
"id": "76436745599328540420034822220063618863",
"namespace": {
"code": "ECID"
}
},
"aacustomid": {
"id": "48593470048917738786405847327596263131",
"namespace": {
"code": "CRMID"
},
"primary": true
},
"acid": {
"id": "2de32e9a80007451-03da600000000028",
"namespace": {
"code": "AVID"
}
}
}
},
"placeContext": {
"localTime": "2018-09-21T19:51:26Z",
"geo": {
"countryCode": "US"
}
}
},
"lastModifiedAt": "2018-10-24T17:34:58Z"
}
],
"_links": {
"next": {
"href": ""
}
}
}
}`
在此示例响应中,列出的第一个配置文件(“GkouAW-yD9aoRCPhRYROJ-TetAFW”)为_links.next.payload
提供了一个值,这意味着此配置文件还有其他结果页。 有关如何访问这些附加结果的详细信息,请参阅以下有关访问附加结果的部分。
访问其他结果 access-additional-results
检索时间序列事件时,可能会返回许多结果,因此结果通常会分页。 如果特定配置文件有后续结果页面,则该配置文件的_links.next.payload
值将包含一个有效负荷对象。
在请求正文中使用此有效负载,您可以对access/entities
端点执行额外的POST请求,以检索该配置文件的后续时间序列数据页。
访问多个架构实体中的时间序列事件
您可以访问通过关系描述符连接的多个实体。 以下示例API调用假定已在两个架构之间定义了关系。 有关关系描述符的详细信息,请阅读Schema Registry API开发人员指南描述符终结点指南。
您可以在请求路径中包含查询参数,以指定要访问的数据。 您可以包含多个参数,以&分隔。 附录的查询参数部分提供了有效参数的完整列表。
API格式
GET /access/entities?{QUERY_PARAMETERS}
请求
以下请求检索包含先前建立的关系描述符的实体,以访问不同架构的信息。
curl -X GET \
https://platform.adobe.io/data/core/ups/access/entities?relatedSchema.name=_xdm.context.profile&schema.name=_xdm.context.experienceevent&relatedEntityId=GkouAW-2Xkftzer3bBtHiW8GkaFL \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
响应
成功的响应将返回与多个实体关联的时间系列事件的分页列表。
{
"_page": {
"orderby": "timestamp",
"start": "cb10369f-a47b-4e65-afb4-06e1ad78a648",
"count": 1,
"next": ""
},
"children": [
{
"relatedEntityId": "GkouAW-2Xkftzer3bBtHiW8GkaFL",
"entityId": "cb10369f-a47b-4e65-afb4-06e1ad78a648",
"timestamp": 1564614939000,
"entity": {
"environment": {
"browserDetails": {}
},
"identityMap": {
"CRMId": [
{
"id": "78520026455138218785449796480922109723",
"primary": true
}
]
},
"commerce": {
"productViews": {
"value": 1
}
},
"productListItems": [
{
"name": "Red shoe",
"quantity": 85,
"storesAvailableIn": [
"da6dced5-9574-4dda-89b5-9dc106903f80",
"981bb433-2ee5-4db0-a19a-449ec9dbf39f"
],
"SKU": "8f998279-797b-4da2-9e60-88bf73a9f15a",
"priceTotal": 934.8
}
],
"_id": "cb10369f-a47b-4e65-afb4-06e1ad78a648",
"commerce": {
"order": {}
},
"placeContext": {
"geo": {
"_schema": {}
}
},
"device": {},
"timestamp": "2019-07-31T23:15:39Z",
"_experience": {
"profile": {
"identityNamespaces": {
"/productListItems[*]/SKU": {
"namespace": {
"code": "ECID"
}
}
}
}
}
},
"lastModifiedAt": "2019-10-10T00:14:19Z"
}
],
"_links": {
"next": {
"href": ""
}
}
}
访问结果的后续页面
检索时序事件时,结果将分页。 如果有后续结果页,则_page.next
属性将包含ID。 此外,_links.next.href
属性通过向access/entities
端点发出其他GET请求来提供用于检索后续页面的请求URI。
后续步骤
按照本指南,您已成功访问Real-Time Customer Profile数据字段、配置文件和时序数据。 要了解如何访问存储在Platform中的其他数据资源,请参阅数据访问概述。
附录 appendix
以下部分提供有关使用API访问Profile数据的补充信息。
查询参数 query-parameters
在/access/entities
终结点的GET请求路径中使用了以下参数。 它们用于标识要访问的配置文件实体,并筛选响应中返回的数据。 必填参数标有标签,其余参数为可选参数。
schema.name
schema.name=_xdm.context.experienceevent
relatedSchema.name
schema.name
是“_xdm.context.experienceevent”,该值必须指定与时间序列事件相关的配置文件实体的架构。relatedSchema.name=_xdm.context.profile
entityId
entityIdNS
)。entityId=janedoe@example.com
entityIdNS
entityId
作为XID提供,则此字段必须指定标识命名空间。entityIdNE=email
relatedEntityId
schema.name
是“_xdm.context.experienceevent”,该值必须指定相关配置文件实体的标识命名空间。 此值遵循与entityId
相同的规则。relatedEntityId=69935279872410346619186588147492736556
relatedEntityIdNS
schema.name
是“_xdm.context.experienceevent”,此值必须为relatedEntityId
中指定的实体指定身份命名空间。relatedEntityIdNS=CRMID
fields
fields=personalEmail,person.name,person.gender
mergePolicyId
mergePoilcyId=5aa6885fcf70a301dabdfa4a
orderBy
(+/-)timestamp
,默认值为+timestamp
。orderby=-timestamp
startTime
startTime=1539838505
endTime
endTime=1539838510
limit
limit=100
property
property=webPageDetails.isHomepage=true&property=localTime<="2020-07-20"
withCA
withCA=true