Question
What we are trying to achieve:
We are using the Cumulative update API (entities/_update) to perform INSERT's on second-level nested attributes. And since the merge of such second-level nested attributes is not happening anymore when using the same crosswalk to add repeated information.
In our case, the aggregation issue is happening on specific fields called "phoneNumbers.commPrefs" and "emails.commPrefs" from the entity "configuration/entityTypes/Profile". Prior to Jan 4th exactly same items inside a "commPrefs" list were being aggregated, but since this date, they won't, which leads to duplicate entries, as follows:
This only happens when the same crosswalk pushes the "commPref" entry. In our scenario, it happens when our user interactions lead to performing 2 requests to POST entities/_update in sequence, with the same data.
Steps to reproduce:
1- Create a sample entity with "emails":
curl --location --request POST 'https://dev-h360.reltio.com/reltio/api/ZuXqn1oCGoHZMDs/entities' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"type": "configuration/entityTypes/Profile",
"attributes": {
"emails": [
{
"value": {
"value": [
{
"value": "jmamertz@yopmail.com"
}
],
"emailKey": [
{
"value": "primary"
}
2- Get the generated URI for the added "emails", such as "entities/1iuIeaVV/attributes/emails/9xxELDAbB", then perform the POST _update call to add a commPref inside it:
curl --location --request POST 'https://dev-h360.reltio.com/reltio/api/ZuXqn1oCGoHZMDs/entities/1iuIeaVV/_update' \
--header 'Authorization: Bearer 41e5365d-e1ee-4323-9467-7a6447997014' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"type": "INSERT_ATTRIBUTE",
"uri": "entities/1iuIeaVV/attributes/emails/9xxELDAbB/commPrefs",
"newValue": [
{
"value": {
"name": [
{
"value": "cs.keepcustomerinformed"
}
]
}
}
],
"crosswalk": {
"type": "configuration/sources/MYIDENTITY",
"value": "consumer-sample",
"sourceTable": "myidentity-dev-Opaque-reltio"
}
}
]'
3- Perform exactly the same request as step 2 again (same data, same crosswalk).
Result:
The new commPref is simply added to the list, but as it is the same as already existing, we were expecting them to merge/aggregate. This is a reference entity with the issue:entities/1iuIeaVV, as follows:
"commPrefs": [
{
"label": "cs.keepcustomerinformed",
"value": {
"name": [
{
"type": "configuration/entityTypes/Profile/attributes/emails/attributes/commPrefs/attributes/name",
"ov": true,
"value": "cs.keepcustomerinformed",
"uri": "entities/1iuIeaVV/attributes/emails/9xxELDAbB/commPrefs/3TuaEbBtc/name/3TuaEbG9s"
}
]
},
"ov": true,
"uri": "entities/1iuIeaVV/attributes/emails/9xxELDAbB/commPrefs/3TuaEbBtc"
},
{
"label": "cs.keepcustomerinformed",
"value": {
"name": [
{
"type": "configuration/entityTypes/Profile/attributes/emails/attributes/commPrefs/attributes/name",
"ov": true,
"value": "cs.keepcustomerinformed",
"uri": "entities/1iuIeaVV/attributes/emails/9xxELDAbB/commPrefs/9xxELDeQz/name/9xxELDihF"
}
]
},
"ov": true,
"uri": "entities/1iuIeaVV/attributes/emails/9xxELDAbB/commPrefs/9xxELDeQz"
}
]
Answer
The POST /entities update API endpoint takes care of this internally, so you do not face this issue.
Therefore, please make use of DELETE attribute event first and then insert attribute event (see https://docs.reltio.com/en/explore/get-going-with-apis-and-rocs-utilities/reltio-rest-apis/model-apis/entities-api/cumulative-entity-update).
Comments
Please sign in to leave a comment.