Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Adobe Campaign - Data Orientated API

Avatar

Level 5

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

6 Replies

Avatar

Level 10

Hi David,

The _key of nms:recipient is the id, not the email. (NmsRecipient.iRecipientId in SQL level).

Regards
J-Serge

Avatar

Level 10

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

Avatar

Level 10

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

Avatar

Level 5

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

Avatar

Correct answer by
Level 10

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

Avatar

Level 1

@davidh2892249 @Jean-Serge_Biro I am facing the same issue even when I'm using the correct primary keys. Here's the payload:

<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:xtk:session'>
    <soapenv:Header/>
    <soapenv:Body>
        <urn:Write>
            <urn:sessiontoken>___3ed1b7d9-d9f5-4765-ba72-cfe76f837e0b</urn:sessiontoken>
            <urn:domDoc>
                <recipient _key="@id" id="874330" xtkschema="nms:recipient">
                    <rcpGrpRel _key="[rcpGroup/@id]">
                        <rcpGroup id="5403520"/>
                    </rcpGrpRel>
                </recipient>
            </urn:domDoc>
        </urn:Write>
    </soapenv:Body>
</soapenv:Envelope>

In my case, the recipient is added separately (which is working fine) and the recipient is added to the list later (which is giving the error). I also referred to the same Adobe Documentation.

 

I am receiving the below error:

<?xml version='1.0'?>
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>
            <faultstring xsi:type='xsd:string'>SOP-330011 Error while executing the method 'Write' of service 'xtk:persist'.</faultstring>
            <detail xsi:type='xsd:string'>Element '' unknown (see definition of schema 'Recipient list contents (nms:rcpGrpRel)').
QUE-370007 Unable to find key values for element 'Lists' (document with schema 'recipient')
XSV-350023 Unable to save document of type 'Recipients (nms:recipient)'.</detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Can you please how did you resolve this and what I'm doing wrong?