Adobe Campaign - Data Orientated API

davidh2892249

06-10-2017

Hi All,

I know the Adobe Campaign Data Model well, but I just getting started making use of the API.

I've been trying to build some simple examples based on the documentation: Data oriented APIs

I'm particularly interested in being able to add/update a Recipient Schema enitity and an entity to a linked schema with a 1-n relationship.

I took the very simple example from the documentation, trying to add a recipient and assocaite them with a list:

<recipient xtkschema="nms:recipient" _operation="insertOrUpdate" _key="@email" email="davidh@profusion.com"

            firstName="David" lastName="Hoye" salutation="Mr" folder-id="877512">

     <rcpGrpRel _key="[rcpGroup/@name]">

         <rcpGroup name="LST1"/>

       </rcpGrpRel>

</recipient>

However the above, returns the following message:

Error while executing the method 'Write' of service 'xtk:persist'.

Element '' unknown (see definition of schema 'Recipient list contents (nms:rcpGrpRel)').

Unable to find key values for element 'Lists' (document with schema 'recipient')

Unable to save document of type 'Recipients (nms:recipient)'.

The List "LST1" certainly exists.

Can anyone suggest what I might be doing wrong? I'm sure there's a simple explanation.

I'm using v6.1 of Adobe Campaign

Thanks

David

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

11-10-2017

Hello David,

Yes, you are right !

Actuallyn there are many situations/use cases, and it is why I greatly appreciate Adobe Campaign, which is both powerful and flexible to manage all these cases...

For example, in some cases I use the triple key (first name, last name, email) to reconciliate (insert/update) records, so it manages quite well registration forms and updating forms that retrieves the right record, in case of an household, where the family shares the same email but the different people give their own last name/first name ; in that case, the 1-n relationship tables insert/update are done with the iRecipientId returned.

In other cases, perhaps the majority I guess, using email as key is enough. Just take care that unicity email is not guaranteed by Adobe Campaign (no unique index on email in factory schema nms:recipient).

Depending on your use case, sending a delivery to an ID means only one message/email, while sending to email can lead to several messages, even if you can let the engine selecting one record among several thanks to the Duplicate addresses exclusion rule of the delivery.
If email is unique for your dataset, there is no problem to submit your delivery directly as well.

Regarding the delivery, you can either use the standard Delivery activity in the workflow with the targetData information (best and easiest way), or use JSAPI submitNotification function (and a continuous delivery most probably) if it is done by your own loop management, either in a workflow or a webApp, such as this code below:

1322386_pastedImage_0.png

Regards
J-Serge

Answers (4)

Answers (4)

davidh2892249

06-10-2017

Hi Jean-Serge,

Thanks for your response.

Just a little odd because this example was shared in Adobe's online documentation.

I take your point on email being used as a key, I would rarely do so - more often than not we tend to use a unique customer id because as you say, in many situations email isn't going to be completely unique amongst a large data set.

Regarding your comment about creating the master data before creating relational data, this makes sense - I just wanted to know the best approach.

e.g. is it possible to create the master recipeint data and relational schema data (e.g. purchases data) in the same request.

or

do we have to split them out into seperate sequential requests.

I have a scenario that i would like to create the example request(s) for:

* Creating (or updating) recipient record(s). With "Customer ID", Email Address etc.

* Adding data to a purchases schema with "Customer ID", Purchase name, Purchase price etc (the schema is linked with a 1-n relationship with a join on "Customer ID" in recipient schema and purchases schema)

* Triggering a delivery template to these recipient records (looping in the purchase table data). I'm comfortable on the settings needed to make this possible (just curious on the best approach of ensuring the data is all added correctly before the email is attempted to be sent).

I look forward to hearing back.

Thanks for your help

David

Jean-Serge_Biro

MVP

06-10-2017

Hi David,


In your case, you try to add in same time the List service and the recipient in same operation.
I think you must split the operation, or perhaps it works only for update the recipient, not insert at the same time.
Though I am not sure.
But I always create the master data before adding/modifying the linked data.

Hope this helps.
Regards
JS

Jean-Serge_Biro

MVP

06-10-2017

Sorry forget my answer, I misleaded your need.

I meant, if you choose something different from the primary key (id for recipient) as xpath of _key value, take care, you are not sure to write the right record but one among many records.

Email is not unique among recipients. You can have even same email along contacts in same folder.

But I mislead you, sorry, this is not your question.

Regards
JS