Service: CreateMailingList

The CreateMailinglist service allows you to create a new mailing list within a Flexmail category. The ID of the created mailing list will be returned to you.

Service Details

SOAP Action: CreateMailingList
SOAP Return Object: CreateMailingListResp

Input

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

Table: instance of CreateMailingListReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
categoryId Y Integer Id of the category in which the new mailing list will be made
mailingListName Y String Name of the new mailing list
mailingListLanguage Y String Language of the new mailing list:
English: EN
French: FR
Dutch: NL

Output

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

Table: instance of CreateMailingListResp

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
mailingListId / Integer Id of the new mailing list

Table: response codes of CreateMailingListResp.

0 No error
220 Authentication error, see header object for detailed information
221 Category id is mandatory
222 Category id is invalid
223 Mailing list name is mandatory
224 Mailing list language is invalid
225 Mailing list already exists
226 Mailing list name too long

Example

This example shows you the creation of a new mailing list "My new mailing list". This list sends email messages to an international audience, so we choose to create it with an English language. This mailing list will be created within the category with id 1234.

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

$createMailingListReq->header = $header;
$createMailingListReq->categoryId = 1234;
$createMailingListReq->mailingListName = "My new mailing list";
$createMailingListReq->mailingListLanguage = "EN";
$createMailingListResp = $SoapClient->__soapCall("CreateMailingList", array($createMailingListReq));

if ($createMailingListResp->errorCode == 0) {
	echo "Mailing list created, new mailng list id: " . $createMailingListResp->mailingListId;
} else {
	echo "Mailing list creation failed: " . $createMailingListResp->errorMessage;
}
?>