I am using API event as a journey source in journey. I am firing this api from apex trigger on creation/updation of records. Below is the API:
Post: https://<subdomain>/interaction/v1/events
Headers: Content-type: application/json
Authorization Bearer <Access-token>
Body:
{
"ContactKey":"vid1",
"EventDefinitionKey":"APIEvent-bc257d7e-36a2-c154-7016-7fc316e5b6d8",
"Data":{
"VID":"vid1",
"Work_Email__c":"[email protected]",
"First_Name__c":"Manali",
"Last_Name__c":"Horane"
}
}
I am using data extension without any primary key but it has subscriber key as unique id 'vid. When API event fired on record creation trigger, DE populated with one record, again when API event fired on same record update trigger, DE gets populated with duplicate records. I want to maintain unique updated records in Data extension. Is there any way of maintaining unique records? Or do I need to use automation activities like script activity or SQL activity for maintaining latest updated unique records in separate DE?
Note: unfortunately if data extension has primary key as 'vid' and when API event fires with same updated record data whose primary key(vid) is already present in Journey data extension it gives error as below:
{
"message": "The event data contains duplicate value for an existing primary key. Please correct the event data and try again.",
"errorcode": 30000,
"documentation": ""
}
Hence Primary key can not be used when API gets triggered multiple times for the same primary key.