The ImportEmailAddresses service allows you to import multiple email addresses to a mailing list at once. Note that the reference id is mandatory in order to return sufficient import status feedback!
SOAP Action: ImportEmailAddresses
SOAP Return Object: ImportEmailAddressesResp
The following table describes the parameters used for calling the ImportEmailAddresses service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
mailingListId | Y | Integer | Mailing list id |
emailAddressTypeItems | Y | Array of EmailAddressType | Array of EmailAddressType |
allowDuplicates | / | Boolean | Allow duplicate entries. Default: false |
overwrite | / | Boolean | Overwrite existing contact with the current data. Existing action information is kept intact. Default: false |
synchronise | / | Boolean | Synchronise the current list with the current data. Add new contacts, overwrite existing contacts, delete missing contacts. Default: false |
referenceField | / | ReferenceFieldType | Indicate which field to use as reference (unique values) default: email |
allowBouncedOut | / | Boolean | Import bounced out contacts or not. Default: true |
sources | / | Array of SourcesType | Optional source from contacts |
overwriteGroups | / | Boolean | Overwrite existing group settings or not. Default: true |
overwritePreferences | / | Boolean | Overwrite existing preference settings or not. Default: true |
defaultLanguage | / | String | If the language parameter is not set in a EmailAddressType the contact will get the language of this parameter. If this parameter is not given the language of the list will be used. Supported language values: nl, fr, en, de, it, es, ru, da, se, zh, pt, pl |
The following table describes the parameters returned from the ImportEmailAddresses 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 |
importEmailAddressRespTypeItems | / | Array of ImportEmailAddressRespType | Array of importEmailAddressRespType |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | Mailing list id is mandatory |
222 | Mailing list id is invalid |
223 | One or more email addresses have encountered import problems Check ImportEmailAddressRespTypeItems for more information |
224 | This error code applies to the importEmailAddressRespType: EmailAddressType’s referenceId is mandatory |
225 | This error code applies to the importEmailAddressRespType: EmailAddressType’s emailAddress is mandatory |
226 | This error code applies to the importEmailAddressRespType: EmailAddressType’s emailAddress is invalid |
227 | This error code applies to the importEmailAddressRespType: EmailAddressType’s emailAddress already exists |
228 | This error code applies to the importEmailAddressRespType: EmailAddressType’s emailAddress is blacklisted |
229 | Subscription plan limit reached |
230 | This error code applies to the importEmailAddressRespType: EmailAddressType’s emailAddress is already bounced out |
231 | Import not allowed |
232 | Invalid reference field |
233 | Invalid default language provided |
This example shows you how to import 3 email addresses using the ImportEmailAddresses API.
<?php $header->userId = USER_ID; $header->userToken = USER_TOKEN; $importEmailAddressesReq->header = $header; $importEmailAddressesReq->mailingListId = 101; $importEmailAddressesReq->emailAddressTypeItems = array(); $emailAddress_1->referenceId = "aFCe553"; $emailAddress_1->emailAddress = "john.doe@example.com"; $emailAddress_2->referenceId = "aFCe554"; $emailAddress_2->emailAddress = "jane.doe@example.com"; $emailAddress_3->referenceId = "aFCe555"; $emailAddress_3->emailAddress = "example@example.com"; array_push( $importEmailAddressesReq->emailAddressTypeItems , $emailAddress_1 ); array_push( $importEmailAddressesReq->emailAddressTypeItems , $emailAddress_2 ); array_push( $importEmailAddressesReq->emailAddressTypeItems , $emailAddress_3 ); $ImportEmailAddressesResp = $SoapClient->__soapCall("ImportEmailAddresses", array($importEmailAddressesReq)); if ($importEmailAddressResp->errorCode = 0) { echo "import succesfull"; } foreach ($ImportEmailAddressesResp->importEmailAddressRespTypeItems as $item) { if ($item->errorCode == 0) { echo "local-id: " . $item->referenceId . " imported succesfull <br>"; } else { echo "local-id: " . $item->referenceId . " error: " . $item->errorMessage . "<br>"; } } ?>