Entities endpoint (Profile access)
51黑料不打烊 Experience Platform enables you to access Real-Time Customer Profile data using RESTful APIs or the user interface. This guide outlines how to access entities, more commonly known as 鈥減rofiles鈥, using the API. For more information on accessing profiles using the Platform UI, please refer to the Profile user guide.
Getting started
The API endpoint used in this guide is part of the . Before continuing, please review the getting started guide for links to related documentation, a guide to reading the sample API calls in this document, and important information regarding required headers that are needed to successfully make calls to any Experience Platform API.
Retrieve an entity retrieve-entity
You can retrieve either a Profile entity or its time series data by making a GET request to the /access/entities
endpoint along with the required query parameters.
API format
code language-http |
---|
|
Query parameters provided in the request path specify which data to access. You can include multiple parameters, separated by ampersands (&).
To access a Profile entity, you must provide the following query parameters:
schema.name
: The name of the entity鈥檚 XDM schema. In this use case, theschema.name=_xdm.context.profile
.entityId
: The ID of the entity you鈥檙e trying to retrieve.entityIdNS
: The namespace of the entity you鈥檙e trying to retrieve. This value must be provided if theentityId
is not an XID.
A complete list of valid parameters is provided in the query parameters section of the appendix.
Request
The following request retrieves a customer鈥檚 email and name using an identity.
accordion | ||
---|---|---|
A sample request to retrieve an entity using an identity | ||
|
Response
A successful response returns HTTP status 200 with the requested entity.
accordion | ||
---|---|---|
A sample response that contains the requested entity | ||
|
note note |
---|
NOTE |
If a related graph links more than 50 identities, this service will return HTTP status 422 and the message 鈥淭oo many related identities鈥. If you receive this error, consider adding more query parameters to narrow your search. |
API format
code language-http |
---|
|
Query parameters provided in the request path specify which data to access. You can include multiple parameters, separated by ampersands (&).
To access the time series events data, you must provide the following query parameters:
schema.name
: The name of the entity鈥檚 XDM schema. In this use case, this value isschema.name=_xdm.context.experienceevent
.relatedSchema.name
: The name of the related schema. Since the schema name is Experience Event, the value of this must berelatedSchema.name=_xdm.context.profile
.relatedEntityId
: The ID of the related entity.relatedEntityIdNS
: The namespace of the related entity. This value must be provided if therelatedEntityId
is not an XID.
A complete list of valid parameters is provided in the query parameters section of the appendix.
Request
The following request finds a profile entity by ID, and retrieves the values for the properties endUserIDs
, web
, and channel
for all time series events associated with the entity.
accordion | ||
---|---|---|
A sample request to retrieve the time series events associated with an entity | ||
|
Response
A successful response returns HTTP status 200 with a paginated list of time series events and associated fields that were specified in the request query parameters.
note note |
---|
NOTE |
The request specified a limit of one (limit=1 ), therefore the count in the response below is 1 and only one entity is returned. |
accordion | ||
---|---|---|
A sample response that contains the requested time series events data | ||
|
API format
code language-http |
---|
|
Query parameters provided in the request path specify which data to access. You can include multiple parameters, separated by ampersands (&).
To access the B2B Account data, you must provide the following query parameters:
schema.name
: The name of the entity鈥檚 XDM schema. In this use case, this value isschema.name=_xdm.context.account
.entityId
: The ID of the entity you鈥檙e trying to retrieve.entityIdNS
: The namespace of the entity you鈥檙e trying to retrieve. This value must be provided if theentityId
is not an XID.
A complete list of valid parameters is provided in the query parameters section of the appendix.
Request
accordion | ||
---|---|---|
A sample request to retrieve a B2B Account | ||
|
Response
A successful response returns HTTP status 200 with the requested entity.
accordion | ||
---|---|---|
A sample response that contains the requested entity | ||
|
API format
code language-http |
---|
|
Query parameters provided in the request path specify which data to access. You can include multiple parameters, separated by ampersands (&).
To access a B2B Opportunity entity, you must provide the following query parameters:
schema.name
: The name of the entity鈥檚 XDM schema. In this use case, theschema.name=_xdm.context.opportunity
.entityId
: The ID of the entity you鈥檙e trying to retrieve.entityIdNS
: The namespace of the entity you鈥檙e trying to retrieve. This value must be provided if theentityId
is not an XID.
A complete list of valid parameters is provided in the query parameters section of the appendix.
Request
accordion | ||
---|---|---|
A sample request to retrieve a B2B Opportunity entity | ||
|
Response
A successful response returns HTTP status 200 with the requested entity.
accordion | ||
---|---|---|
A sample response that contains the requested entity | ||
|
Retrieve multiple entities retrieve-entities
You can retrieve multiple Profile entities or time series events by making a POST request to the /access/entities
endpoint and providing the identities in the payload.
API format
code language-http |
---|
|
Request
The following request retrieves the names and email addresses of several customers by a list of identities.
accordion | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A sample request to retrieve multiple entities | |||||||||||||||||||||||||||||||||||
|
Response
A successful response returns HTTP status 200 with the requested fields of entities specified in the request body.
accordion | ||
---|---|---|
A sample response that contains the requested entities | ||
|
API format
code language-http |
---|
|
Request
The following request retrieves user IDs, local times, and country codes for time series events associated with a list of profile identities.
accordion | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A sample request to retrieve the time series data | ||||||||||||||||||||||||||||||||
|
Response
A successful response returns HTTP status 200 with a paginated list of time series events associated with the multiple profiles specified in the request.
accordion | ||
---|---|---|
A sample response that contains the time series events | ||
|
note note |
---|
NOTE |
In this example response, the first listed profile (鈥淕kouAW-yD9aoRCPhRYROJ-TetAFW鈥) provides a value for _links.next.payload , meaning that there are additional pages of results for this profile. |
To access these results, you can perform an additional POST request to the /access/entities endpoint with the listed payload as the request body. |
API format
code language-http |
---|
|
Request
The following request retrieves the requested B2B Accounts.
accordion | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A sample request to retrieve multiple entities | ||||||||||||||||||||
|
Response
A successful response returns HTTP status 200 with the requested entities.
accordion | ||
---|---|---|
A sample response that contains the requested entities | ||
|
API format
code language-http |
---|
|
Request
The following request retrieves the requested B2B opportunities.
accordion | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A sample request to retrieve multiple entities | ||||||||||||||||||||
|
Response
A successful response returns HTTP status 200 with the requested entities.
accordion | ||
---|---|---|
A sample response that contains the requested entities | ||
|
Access a subsequent page of results
Results are paginated when retrieving time series events. If there are subsequent pages of results, the _page.next
property will contain an ID. Additionally, the _links.next.href
property provides a request URI for retrieving the next page. To retrieve the results, make another GET request to the /access/entities
endpoint and replace /entities
with the value of the provided URI.
/entities/
in the request path. It should only appear once like, /access/entities?start=...
API format
GET /access/{NEXT_URI}
{NEXT_URI}
_links.next.href
.Request
The following request retrieves the next page of results by using the _links.next.href
URI as the request path.
code language-shell |
---|
|
Response
A successful response returns the next page of results. This response does not have subsequent pages of results, as indicated by the empty string values of _page.next
and _links.next.href
.
code language-json |
---|
|
Delete an entity delete-entity
You can delete an entity from the Profile Store by making a DELETE request to the/access/entities
endpoint along with the required query parameters.
API format
DELETE /access/entities?{QUERY_PARAMETERS}
Query parameters provided in the request path specify which data to access. You can include multiple parameters, separated by ampersands (&).
To delete an entity, you must provide the following query parameters:
schema.name
: The name of the entity鈥檚 XDM schema. In this use case, you can only useschema.name=_xdm.context.profile
.entityId
: The ID of the entity you鈥檙e trying to retrieve.entityIdNS
: The namespace of the entity you鈥檙e trying to retrieve. This value must be provided if theentityId
is not an XID.mergePolicyId
: The merge policy ID of the entity. The merge policy contains information about identity stitching and key-value XDM object merging. If this value is not provided, the default merge policy will be used.
Request
The following request deletes the specified entity.
code language-shell |
---|
|
Response
A successful response returns HTTP status 202 with an empty response body.
Next steps
By following this guide you have successfully accessed Real-Time Customer Profile data fields, profiles, and time series data. To learn how to access other data resources stored in Platform, see the Data Access overview.
Appendix appendix
The following section provides supplemental information regarding accessing Profile data using the API.
Query parameters query-parameters
The following parameters are used in the path for GET requests to the /access/entities
endpoint. They serve to identify the profile entity you wish to access and filter the data returned in the response. Required parameters are labeled, while the rest are optional.
schema.name
schema.name=_xdm.context.experienceevent
relatedSchema.name
schema.name
is _xdm.context.experienceevent
, this value must specify the schema for the profile entity that the time series events are related to.relatedSchema.name=_xdm.context.profile
entityId
entityIdNS
) must also be provided.entityId=janedoe@example.com
entityIdNS
entityId
is not provided as an XID, this field must specify the identity namespace.entityIdNS=email
relatedEntityId
schema.name
is _xdm.context.experienceevent
, this value must specify the related profile entity鈥檚 ID. This value follows the same rules as entityId
.relatedEntityId=69935279872410346619186588147492736556
relatedEntityIdNS
schema.name
is 鈥淿xdm.context.experienceevent鈥, this value must specify the identity namespace for the entity specified in relatedEntityId
.relatedEntityIdNS=CRMID
fields
fields=personalEmail,person.name,person.gender
mergePolicyId
mergePolicyId=5aa6885fcf70a301dabdfa4a
orderBy
(+/-)timestamp
, with the default being +timestamp
.orderby=-timestamp
startTime
startTime=1539838505
endTime
endTime=1539838510
limit
limit=100
property
property=webPageDetails.isHomepage=true&property=localTime<="2020-07-20"