Subscribers.GetSingleSubscriber
This method returns all of a particular subscribers details, including email address, name, active/inactive status and all custom field data. If a subscriber with that email address does not exist in that list, an empty record is returned.
Samples
The following samples include specific examples of this method in action:
- .NET - 51kb (see getsinglesubscriber.aspx)
We also provide a range of samples for other programming languages such as PHP, Classic ASP, Flash, Perl and Cold Fusion that can be easily adapted to use this method.
Parameters and required information
Here's a list of all the parameters you'll need to pass to the Subscribers.GetSingleSubscriber method. All of the parameters are required unless otherwise noted.
ApiKey- Your API application key. See here for more details.
ListID- The list that the subscriber belongs to. See here for more details.
Email- The email address of the subscriber you are getting the details of.
Return Codes
Success
Upon a successful call, a Subscriber object will be returned. If the subscriber being queried for does not exist in that list, an empty object will be returned.
Error
1: Invalid email address- The email value passed in was a valid email address.
100: Invalid API Key- The API key passed was not valid or has expired.
101: Invalid ListID- The ListID value passed in was not valid.
SOAP 1.1
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx HTTP/1.1 Host: app.campaignmonitor.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://app.campaignmonitor.com/api/Subscribers.GetSingleSubscriber" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Subscribers.GetSingleSubscriber xmlns="http://app.campaignmonitor.com/api/"> <ApiKey>string</ApiKey> <ListID>int</ListID> <EmailAddress>string</EmailAddress> </Subscribers.GetSingleSubscriber> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Subscribers.GetSingleSubscriberResponse xmlns="http://app.campaignmonitor.com/api/">
<Subscribers.GetSingleSubscriberResult />
</Subscribers.GetSingleSubscriberResponse>
</soap:Body>
</soap:Envelope>
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /api/api.asmx/Subscribers.GetSingleSubscriber?ApiKey=string&ListID=string&EmailAddress=string HTTP/1.1 Host: app.campaignmonitor.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<anyType xmlns="http://app.campaignmonitor.com/api/" />
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /api/api.asmx/Subscribers.GetSingleSubscriber HTTP/1.1 Host: app.campaignmonitor.com Content-Type: application/x-www-form-urlencoded Content-Length: length ApiKey=string&ListID=string&EmailAddress=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<anyType xmlns="http://app.campaignmonitor.com/api/" />