Service: ImportBlacklist

The ImportBlacklist service allows you to import multiple email addresses to either the overall blacklist of a set of specified mailing list blacklists at once.

Service Details

SOAP Action: ImportBlacklist
SOAP Return Object: ImportBlacklistResp

Input

The following table describes the parameters used for calling the ImportBlacklist service.

Table: instance of ImportBlacklistReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
emailAddressTypeItems Y Array of EmailAddressType Array of EmailAddressType
mailingListTypeItems / Array of MailingListType Array of MailingListType

Output

The following table describes the parameters returned from the ImportBlacklist service.

Table: instance of ImportBlacklistResp

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
ImportBlacklistRespTypeItems / Array of ImportBlackListRespType Array of ImportBlackListRespType

Table: response codes of ImportBlacklistResp.

0 No error
220 Authentication error, see header object for detailed information
221 Invalid mailing list detected
222 Invalid email address
223 This error code applies to the importBlacklistRespType: Email Address in blacklist
230 This error code applies to the importBlacklistRespType: Internal error

Example

This example shows you how to import 2 email addresses to the blacklist of 2 mailing lists with ids 1234 and 1235.

<?php
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

$importBlacklistReq->header = $header;
$importBlacklistReq->mailingListTypeItems = array();
$importBlacklistReq->emailAddressTypeItems = array();

$emailAddress_1->emailAddress = "john.doe@example.com";
$emailAddress_2->emailAddress = "jane.doe@example.com";

array_push( $importBlacklistReq->emailAddressTypeItems , $emailAddress_1 );
array_push( $importBlacklistReq->emailAddressTypeItems , $emailAddress_2 );

$mailingListA->mailingListId = 1234;
$mailingListB->mailingListId = 1235;

array_push($importBlacklistReq->mailingListTypeItems, $mailingListA);
array_push($importBlacklistReq->mailingListTypeItems, $mailingListB);

$ImportBlacklistResp = $SoapClient->__soapCall("ImportBlacklist",  array($importBlacklistReq));

if ($importBlacklistResp->errorCode = 0) {
	echo "import succesfull";
}
	
foreach ($ImportBlacklistResp->importBlacklistRespTypeItems as $item) {
	if ($item->errorCode == 0) {
		echo "local-id: " . $item->referenceId . " imported succesfull <br>";
	} else {
		echo "local-id: " . $item->referenceId . " error: " . $item->errorMessage . "<br>";
	}
}
?>