Service: UpdatePreference

The UpdatePreference service allows you to update existing preferences within Flexmail.

Service Details

SOAP Action: UpdatePreference
SOAP Return Object: UpdatePreferenceResp

Input

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

Table: instance of UpdatePreferenceReq

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

Output

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

Table: instance of UpdatePreferenceResp

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

Table: response codes of UpdatePreferenceResp.

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

Example

This example shows the update of a preference with id ‘881’. We are updating the name and the label of the preference.

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

$updatePreferenceReq->header = $header;
$updatePreferenceReq->preferenceType->preferenceId = 881;
$updatePreferenceReq->preferenceType->preferenceName = "my updated preference";
$updatePreferenceReq->preferenceType->preferenceLabel  = "my updated preference label";

$updatePreferenceResp = $SoapClient->__soapCall("UpdatePreference", array($updatePreferenceReq));

if ($updatePreferenceResp ->errorCode == 0) {
	echo "Preference updatded";
} else {
	echo "Preference update failed: " . $updatePreferenceResp ->errorMessage;
}
?>