Retreiving opt out customers from the API

reports
api

(Phil Doh) #1

Hi All,

I would like to retrieve a list of all email addresses that have been opted out between a certain date range via the API. I’ve been through the API documentation for both REST and legacy but I can’t see an endpoint that would do this. I also can’t see a way to work around it.

The closest thing I can see is the Reports endpoint in the Legacy docs but even that doesn’t have the information I’m after.

Wou


(Tom Scott) #2

We do have a feature request in our backlog to allow Opt-Out Status as a filter on the Contact search endpoint for REST, but it is not implemented yet. I’ll add this thread as a reference on the ticket.


(John Borelli) #3

Technically speaking, your opt out status is on the email address and not the contact itself. If a contact (or a number of contacts) use an email address that has been opted out then you would get all of those contacts. There is a table that would give you a list of the opt out email addresses and then the contact table could be queried for all contacts using each address (two step process of course) in the interim until what @TomScott had mentioned comes into fruition.


(Phil Doh) #4

Thanks John, what api endpoint gives the list of opted out email addresses? Is there a way to use a date range to only retrieve e-mails opted out in the last x days.

The reason for the date range is that the number of opt outs will keep growing and I’ll probably hit issues with it in the future unless I can limit it somehow.


(John Borelli) #5

You would need to use the standard api (not REST) and read the EmailAddStatus table:

https://developer.infusionsoft.com/docs/table-schema/


(Phil Doh) #6

Thanks John, is there any documentation on how to use the legacy API Data Service with .NET. I’ve had a good look and can’t see anything. I’m already using something like the below to opt out emails -

var contactService = XmlRpcProxyGen.Create();
var result = contactService.OptOutByEmail(keyId, email, “OptingOut”);

Which is using the legacy API via the CookComputing.XmlRpc library.

Would reading all the email from the table on a daily basis via this method cause any issues?


(Phil Doh) #7

I found a bit more information but it looks like that table isn’t part of the .net library. See attached image.