Expand my Community achievements bar.

SOLVED

API Logic - SELECT from recipient schema

Avatar

Level 1

Hi,

 

I'm leveraging an API to retreive a user's opt-in status in Adobe Campaign Classic.  See below

 

How does this work if I'm retreiving a user's status who has an email with multiple profile IDs? How does the API decide which status I would retrieve?

 

Note.. I testing the API and I receive multiple statuses. So my new question is, how does determine the order by which i receive the status? Would it be the most recently created profile? 

 

 

 

Request


POST /nl/jsp/soaprouter.jsp HTTP/1.1
Host: example.campaign.adobe.com
Content-Type: text/xml
SOAPAction: xtk:queryDef#ExecuteQuery

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:queryDef">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:ExecuteQuery>
         <urn:sessiontoken>{TOKEN}</urn:sessiontoken>
         <urn:entity>
            <queryDef operation="select" schema="nms:recipient">
            	<select><node expr="[optinInfo/email/@optinEmail]"/></select>
            	<where><condition expr="@email = 'mrwrench@gmail.com'"/></where>
            </queryDef>
         </urn:entity>
      </urn:ExecuteQuery>
   </soapenv:Body>
</soapenv:Envelope>
Response


<?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:ns='urn:xtk:queryDef' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
    <SOAP-ENV:Body>
        <ExecuteQueryResponse xmlns='urn:xtk:queryDef' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
            <pdomOutput xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
                <recipient-collection>
                    <recipient>
                        <optinInfo>
                            <email optinEmail="NO"/>
                        </optinInfo>
                    </recipient>
                </recipient-collection>
            </pdomOutput>
        </ExecuteQueryResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @twilliams629 

API cannot know what you expect. In this case define further what you expect (select only one record after sorting by prefered field).
For example: Use getIfExists instead of select and define <orderBy><node expr="@some_field"/></orderBy>

Regards,

Milan

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hello @twilliams629 

API cannot know what you expect. In this case define further what you expect (select only one record after sorting by prefered field).
For example: Use getIfExists instead of select and define <orderBy><node expr="@some_field"/></orderBy>

Regards,

Milan

Avatar

Community Advisor

Hi @twilliams629 ,

 

Analyse your usecase based on table structure.

1) Let's suppose your data structure is based on 'Store Order' and based on email address you want to know the status of order purchased. Then, put an additional condition in where clause and it can be based on latest purchase or Order with status not equal to 'Cancelled' or 'Completed'.

2) Also, if your table structure is simple i.e just recipients details, then you should find status based on most recent date.

 

You have define more precisely which type of data your table stores and what output you desire to get.

 

Thanks,

Jyoti

 

Avatar

Administrator

Hi @twilliams629,

 

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know.


Thanks!



Sukrity Wadhwa