Service: UpdateTemplate

The UpdateTemplate service allows you to update existing templates within Flexmail.

Service Details

SOAP Action: UpdateTemplate
SOAP Return Object: UpdateTemplateResp

Input

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

Table: instance of UpdateTemplateReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
templateType Y TemplateType Template type

Output

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

Table: instance of UpdateTemplateResp

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 UpdateTemplateResp.

0 No error
220 Authentication error, see header object for detailed information
221 Template id is mandatory
222 Template name is mandatory
223 Invalid template id
224 Template already exists
225 Internal error

Example

This example shows the update of a template with id ‘712’. We are updating the name and the text of the template.

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

$updateTemplateReq->header = $header;
$updateTemplateReq->templateType->templateId = 712;
$updateTemplateReq->templateType->templateName = mb_convert_encoding(‘my updated template’,’utf-8’) ;
$updateTemplateReq->templateType->templateText =urlencode(mb_convert_encoding(‘<html>update</html>’,’utf-8’));
$updateTemplateResp = $SoapClient->__soapCall("UpdateTemplate", array($updateTemplateReq));

if( $updateTemplateResp->errorCode == 0 ){
	echo "Template updatded";
}else{
	echo "Template update failed: " . $updateLandingPageResp->errorMessage;
}

?>