We've got the the following code that is supposed to retrieve ALL unsubscribed entries from a list. With our data, this is hitting the 2500 limit.
I had a look at the ruby sdk, where they have a "continue" method if there are more results. I couldn't find the equivalent in the Java sdk though…
Can anybody point me in the right direction on how to do this?
ETListSubscriberService listSubscriberService = new ETListSubscriberServiceImpl();
... //create filter with list id and unsubscribed status
ETResponse<ETListSubscriber> response = listSubscriberService.get(client, filterByListIdAndUnsubscribedStatus);
response.getResults(); //does not return more than the 2500 limit
if(response.hasMoreResults()){
//what to do from here???
}
Thanks for any pointers.
Best Answer
if you receive status='OK' it means less than 2500 records, you don't need to send more API calls.
If you receive status='MoreDataAvailable', it means there are more records, you need to get the requestID value returned, then make another API call with RetrieveRequest.ContinueRequest with that requestID value.Put it into a while loop, until you see status='OK' then exit the loop