Service: CreatePreference

The CreatePeference service allows you to create a new preference within Flexmail. The ID of the newly created preference will be returned to you.

Service Details

SOAP Action: CreatePreference
SOAP Return Object: CreatePreferenceResp

Input

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

Table: instance of CreatePreferenceReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
preferenceType / PreferenceType Preference type to create

Output

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

Table: instance of CreatePreferenceResp

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
preferenceId / Integer Id of the new preference

Table: response codes of CreatePreferenceResp.

0 No error
220 Authentication error, see header object for detailed information
221 Preference name is mandatory
222 Preference label is mandatory
225 Preference already exists
230 Preference module not activated for this account

Example

This example shows you the creation of a new preference within Flexmail, the name of our preference is "my new preference".

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

$createPreferenceReq->header = $header;
$createPreferenceReq->preferenceType->preferenceName = "my new preference";
$createPreferenceReq->preferenceType->preferenceLabel  = "my new preference label";
$createPreferenceReq->preferenceType->preferenceDescription = "my new preference description";

$createPreferenceResp = $SoapClient->__soapCall("CreatePreference", array($createPreferenceReq));

if ($createPreferenceResp->errorCode == 0) {
	echo "Preference created, the new preference id=" . $createPreferenceResp->preferenceId;
} else {
	echo "Template creation failed: " . $createPreferenceResp->errorMessage;
}
?>