The GetUnsubscriptions service allows you to recall unsubscribed email addresses. Unsubscribed email addresses can be recalled in one of two ways, either by mailing list id or by campaign id.
When requesting by mailing list id, all bounced email addresses in the mailing list, that unsubscribed since the last call to the GetUnsubscriptions service, for the specified mailing list id, will be returned. A timestampSince may be provided, the service will than return all unsubscribed email addresses for the specified mailing list id that unsubscribed since the given timestamp.
When requesting by campaign id, all email addresses that unsubscribed for the campaign will be returned. The timestampSince member becomes obsolete.
SOAP Action: GetUnsubscriptions
SOAP Return Object: GetUnsubscriptionsResp
The following table describes the parameters used for calling the GetUnsubscriptions service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
campaignId | / | Integer | Campaign id |
mailingListId | / | Integer | Mailing list id |
timestampSince | / | String | Timestamp which marks the beginning of the searchable period |
The following table describes the parameters returned from the GetUnsubscriptions service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | / | APIResponseHeader | Header containing authentication information |
errorCode | / | Integer | Numerical value of the error |
errorMessage | / | String | Short literal description of the error |
unsubscriptionTypeItems | / | Array of UnsubscriptionType | Array of UnsubscriptionsType items |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | Mailing list id or campaign id is mandatory |
222 | Mailing list id is invalid |
223 | Campaign id is invalid |
224 | Invalid timestamp YYYY-MM-DDTHH:II:SS |
This examples show the request of all email addresses that unsubscribed for campaign 222.
<?php $header->userId = USER_ID; $header->userToken = USER_TOKEN; $getUnsubscriptionsReq->header = $header; $getUnsubscriptionsReq->campaignId = 222; $getUnsubscriptionsResp = $SoapClient->__soapCall("GetUnsubscriptions", array($getUnsubscriptionsReq)); if ($getUnsubscriptionsResp->errorCode == 0) { // Handle return list of unsubscriptions. } else { echo "Unsubscriptions could not be retrieved: " . $getUnsubscriptionsResp->errorMessage; } ?>