1

I am using the ExactTarget API call Retrieve to retrieve a large number of SentEvent Objects. When there are more than 2500 rows returned we use the property ContinueRequest to loop through all the rows in chunks. This all works well as described in the documentation.

The problem is when we have an API exception while using the ContinueRequest property. In this case the set of data is not returned because we receive and Exception back. So, I am trying to use the RepeatLastResult property with ContinueRequest and get the missing data set that was missed because of the exception. Unfortunately I have never been able to Repeat the last data set. There are no examples I can find of the actually being used. It doesn't appear to even work as intended. Can someone look at this and let me know how to use it?

Thanks, Kert

  • What is the exception you are receiving on ContinueRequest? – Jon Sakas May 21 '14 at 21:17
  • There is no exception. It just Continues the request without repeating the last batch of records. Basically it doesn't work as the document specifies. – user8481 May 27 '14 at 18:22
  • Can someone at least give me a working example of how ContiueRequest is supposed to work. – user8481 Jun 2 '14 at 19:46
2

There are 2 scenarios where data could be seen as coming back in batches when using the Retrieve method SOAP API.

1 - When attempting to retrieve records and there are more than 2500 records based on the filter criteria, it will response with a status of "MoreDataAvailable" meaning a follow-up request is necessary in order to get the remaining records. This could go through multiple iterations since it will only return 2500 each time.

Example First Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <! -- Header Removed for example purposes -->
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>SentEvent</ObjectType>
            <Properties>Client.ID</Properties>
            <Properties>SendID</Properties>
            <Properties>SubscriberKey</Properties>
            <Properties>EventDate</Properties>
            <Properties>BatchID</Properties>
            <Properties>SendID</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Property>SendID</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>10952795</Value>
            </Filter>        
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Example Response from above request:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
   <! -- Header Removed for example purposes -->
   </soap:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>MoreDataAvailable</OverallStatus>
         <RequestID>6d0c151b-84a9-4201-845a-66b3d573405c</RequestID>
         <Results xsi:type="SentEvent">
            <Client>
               <ID>111111</ID>
            </Client>
            <PartnerKey xsi:nil="true"/>
            <ObjectID xsi:nil="true"/>
            <SendID>10952354</SendID>
            <SubscriberKey>example@example.com</SubscriberKey>
            <EventDate>2009-06-17T13:04:22.777</EventDate>
            <BatchID>0</BatchID>
         </Results>
         <!-- For illustration purposes the remaining 2499 results have been removed -->
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>

Example Follow-up Request using the RequestID (6d0c151b-84a9-4201-845a-66b3d573405c) from the above request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <! -- Header Removed for example purposes -->
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ContinueRequest>6d0c151b-84a9-4201-845a-66b3d573405c</ContinueRequest>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

The response from that last request would look similar to the example response provided above and will continue to show "MoreDataAvailable" for the OverallStatus until all records have been returned at which point it will be returneds as "OK".

2 - With TrackingEvents (ClickEvent, SentEvent, and others) there is also the concept of batch which is leveraged using the RetrieveAllSinceLastBatch property on the RetrieveRequest. This also where the property RepeatLastResult can be used. In order to setup a batch, set RetrieveAllSinceLastBatch to true in the SOAP Request. This tells the ExactTarget system to keep track of the records that are returned when retrieving that object with that filter. If the filter or properties list is changed, then that would be a new/different batch. This is helpful since it allows for only retrieving new information so it can be used for an hourly or daily request which pulls in tracking data to an external system.

The RepeatLastResult works in conjunction with RetrieveAllSinceLastBatch, if it is set to true, it will retrieve the last batch that was returned which is helpful if you have a process that full tracking on an interval but there was a system issue that prevented the last instance from running successfully.

Example Request setting RetrieveAllSinceLast Batch to true:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <! -- Header Removed for example purposes -->
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>OpenEvent</ObjectType>
            <Properties>SendID</Properties>
            <Properties>SubscriberKey</Properties>
            <Properties>EventDate</Properties>
            <Properties>BatchID</Properties>
            <Properties>SendID</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Property>SendID</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>10952795</Value>
            </Filter>
            <RetrieveAllSinceLastBatch>true</RetrieveAllSinceLastBatch>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Example Response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
     <! -- Header Removed for example purposes -->
   </soap:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>OK</OverallStatus>
         <RequestID>8ad7af38-c23b-43da-9b04-92fcb56f5d4a</RequestID>
         <Results xsi:type="OpenEvent">
            <PartnerKey xsi:nil="true"/>
            <ObjectID xsi:nil="true"/>
            <SendID>10952354</SendID>
            <SubscriberKey>A600AA40-377A-41EA-9190-734BC70804F9</SubscriberKey>
            <EventDate>2009-06-17T13:05:00</EventDate>
            <BatchID>0</BatchID>    
         </Results>
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>

Example Response if you make the same request again the result will be empty, since no additional OpenEvents were generated in the time between the first and 2nd request:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
     <! -- Header Removed for example purposes -->
   </soap:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>OK</OverallStatus>
         <RequestID>38e011cd-c851-4191-bb44-060303aed4ea</RequestID>
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>

Example Request setting RetrieveAllSinceLast Batch to true and RepeatLastResult to true:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <! -- Header Removed for example purposes -->
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>OpenEvent</ObjectType>
            <Properties>SendID</Properties>
            <Properties>SubscriberKey</Properties>
            <Properties>EventDate</Properties>
            <Properties>BatchID</Properties>
            <Properties>SendID</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Property>SendID</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>10952795</Value>
            </Filter>
            <RetrieveAllSinceLastBatch>true</RetrieveAllSinceLastBatch>
            <RepeatLastResult>true</RepeatLastResult>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Example Response will look exactly like the first response mentioned in this section but with a different RequestID:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
     <! -- Header Removed for example purposes -->
   </soap:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>OK</OverallStatus>
         <RequestID>3974e681-4ed2-422a-89d5-182c4c280155</RequestID>
         <Results xsi:type="OpenEvent">
            <PartnerKey xsi:nil="true"/>
            <ObjectID xsi:nil="true"/>
            <SendID>10952354</SendID>
            <SubscriberKey>A600AA40-377A-41EA-9190-734BC70804F9</SubscriberKey>
            <EventDate>2009-06-17T13:05:00</EventDate>
            <BatchID>0</BatchID>
         </Results>
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.