Many struggles with saved searches, XML API, rest API

I want to synchronize all contact’s email status and tags with our local database.

I started this project with the Rest API but quickly realized /contacts does not return ‘email status’ which is really too bad. I’d have to request each contact individually and this seems somewhat impractical with 150,000 contacts.

I turned to the XML API because it seemed like I could create a saved report sorted by ‘last updated’ that would do the trick in keeping synchronization timely. I created the report. It looked good. Tags and Email status are included. I made the report available to everyone. I didn’t see any other way to get this field included without using a saved report.

Using the DataService.query returns a list of the saved reports, but it doesn’t contain the MemberID of the user that created it. This report simply says “0”. That seems like an oversight, there’s no way to determine the owner of a saved report if it’s been shared with other people. If you try using SearchService.getSavedSearchResultsAllFields with a UserID of 0 you receive " [Unexpected]Unable to get saved search results ."

I was able to determine the UserID, but now SearchService.getSavedSearchResultsAllFields runs for a few brief seconds and then ‘Server returned a fault exception: [4] [DatabaseError]Query took too long and was cancelled’. The report runs fine in the CRM. There is no way to set a page size, either.

I’m stumped and a little frustrated.

What is the best way to retrieve an export of the database containing contact IDs, tags, and email status without hammering the entire contact database.


Removing the “Sort by last updated” parameter on the email status report allows it to execute much quicker and allows the API to actually start returning results.

But now I lose the efficient method for capturing updates to everyone’s email status and assigned tags.


I’ll just do it a slower way. Spent too much time on this