The CreatePeference service allows you to create a new preference within Flexmail. The ID of the newly created preference will be returned to you.
SOAP Action: CreatePreference
SOAP Return Object: CreatePreferenceResp
The following table describes the parameters used for calling the CreatePreference service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
preferenceType | / | PreferenceType | Preference type to create |
The following table describes the parameters returned from the CreatePreference 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 |
preferenceId | / | Integer | Id of the new preference |
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 |
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; } ?>