Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.Admin.WSTemplateResponse UpdateTemplate(
   string securityToken,
   SBT.API.DataContracts.Admin.TemplateDetail template
)

 

WSDL

 

Production: https://ui.solutionsbytext.com/Sbt.App.SetUp/WSServices/templateWSService.svc?singleWsdl

Staging: https://test.solutionsbytext.com/Sbt.App.SetUp/WSServices/templateWSService.svc?singleWsdl

 

Parameters

securityToken

– String[1000] (Required) – SecurityToken to authenticate the user.

template

TemplateDetail – TemplateDetail object.
* TemplateID – int (Required) – TemplateID of the template.
* Title – String[100] (Required) – Title of the template.
* Subject – String[100] (Required) – Subject of the template.
* Text – String[160] (Required) – Actual message of the template.
* Description – String[160] (Optional) – Added description or note of the template.
* OrgCode – String[20] (Required) – Organization Code for the group.

 

Return Value

WSTemplateResponse
Name Type Description
Result bool True/False whether the call was successful or not.
ErrorCode int For Success/Failure it returns an error number.
Message string Message related to Error code.
Response TemplateDetail TemplateDetail object.
* TemplateID – TemplateID.
* Title – Template Title.
* Text – Template Text.
* Subject – Template Subject.
* Description – Template Description.

 

Examples

C#

lblError.Text = "";
TemplateClient templateService = new TemplateClient("TemplateWSServiceHttpEndpoint");
string securityToken = txtToken.Text;

    TemplateDetail templateDetail = new TemplateDetail();
    templateDetail.TemplateID = Convert.ToInt32(txtTemplateID.Text.Trim());
    templateDetail.Title = txtTitle.Text.Trim();
    templateDetail.Subject = txtSubject.Text.Trim();
    templateDetail.Text = txtText.Text.Trim();
    templateDetail.Description = txtDescription.Text.Trim();
    templateDetail.OrgCode = txtOrgCode.Text.Trim();

    WSTemplateResponse wSTemplateResponse = templateService.UpdateTemplate(securityToken, templateDetail);

        if (!wSTemplateResponse.Result)
            {
                //handle error
                lblError.Text = wSTemplateResponse.Message;
            }
        else
            {
                //handle success
                lblError.Text = wSTemplateResponse.Message;
            }

SOAP

Soap Request
   
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:dat="http://SBTAPIService/DataContract/">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:UpdateTemplate>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
         <ser:template>
            <!--Required:-->
            <dat:TemplateID>Template ID</dat:TemplateID>
            <!--Required:-->
            <dat:Title>Updated Title</dat:Title>
            <!--Required:-->
            <dat:Subject>Updated Subject</dat:Subject>
            <!--Required:-->
            <dat:Text>Updated Text</dat:Text>
            <!--Optional:-->
            <dat:Description>Updated Description</dat:Description>
            <!--Required:-->
            <dat:OrgCode>Group Org Code</dat:OrgCode>
         </ser:template>
      </ser:UpdateTemplate>
   </soapenv:Body>
</soapenv:Envelope>

   

Soap Response
  
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <UpdateTemplateResponse xmlns="http://SBTService/ServiceContracts/">
         <UpdateTemplateResult z:Id="i1" xmlns:a="http://SBTAPIService/DataContract/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
            <a:Result>true</a:Result>
            <a:ErrorCode>1011</a:ErrorCode>
            <a:Message>Template updated successfully</a:Message>
            <a:Response z:Id="i2">
               <a:TemplateID>Template ID</a:TemplateID>
               <a:Title> Updated Title of Template </a:Title>
               <a:Subject> Updated Subject of template </a:Subject>
               <a:Text> Updated Text of template </a:Text>
               <a:Description>Updated Description </a:Description>
            </a:Response>
         </UpdateTemplateResult>
      </UpdateTemplateResponse>
   </s:Body>
</s:Envelope>

JAVA

  TemplateWSService srv = new TemplateWSService();
  ITemplate iTemplate = srv.getTemplateWSServiceHttpEndpoint1();
  WSTemplateResponse res = null;
		
  String  securityToken = "securityToken";
  String orgCode = "orgCode";
  TemplateDetail template = new TemplateDetail();	    
  template.setTitle(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Title"),
				new String("").getClass(),"Test-1"));
  template.setSubject(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Subject"),
				new String("").getClass(),"Test"));
  template.setText(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Text"),
				new String("").getClass(),"This is a test template"));
  template.setDescription(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "Description"),
				new String("").getClass(),"Remarks"));
  template.setOrgCode(new JAXBElement(new QName("http://SBTAPIService/DataContract/", "OrgCode"),
				new String("").getClass(),"OrgCode"));
		
  try {
		res = iTemplate.updateTemplate(securityToken, template);

  } catch (Throwable e) {
			e.printStackTrace();
  }

  if(res == null ){
			System.out.println("::Erron::");
			return;

  }
  if (res.isResult() == null || !res.isResult())
  {
			//handle error
			System.out.println("ErrorCode::"+res.getErrorCode());
			System.out.println("ErrorMessage::"+res.getMessage().getValue());
  }
  else
  {
			//handle success
			System.out.println("ID::"+res.getId());
			System.out.println("Message::"+res.getMessage().getValue());
  }

PHP

<?php
    $client = new SoapClient("https://ui.solutionsbytext.com/Sbt.App.SetUp/wsservices/templateWSService.svc?wsdl");
    $param = array(
	'securityToken' => 'securityToken',
	'template' => array(
		'TemplateID' => '21',
		'Title' => 'Test1-1',
		'Subject' => 'Test',
		'Text' => 'This is a test template',
		'Description' => 'Remarks',
		'OrgCode' => 'OrgCode'
	)
);

$response = $client->__soapCall('UpdateTemplate', array($param));
echo '
';
print_r($response);
if($response->UpdateTemplateResult->Result){
	echo 'Message: '.$response->UpdateTemplateResult->Message;
}
else {
	echo 'Message: '.$response->UpdateTemplateResult->Message;
}

?>

REST

Method: PUT

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/TemplateRSService.svc/UpdateTemplate

Sample C# Code:

TemplateDetail tempDetail = new TemplateDetail
            {
                TemplateID = 123,
                Title = "Title",
                Subject = "Subject",
                Text = "Text",
                Description = "Description",
                OrgCode = "OrgCode"
            };
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(SubscriberDetails));
            MemoryStream mem = new MemoryStream();
            ser.WriteObject(mem, tempDetail);
            string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);

            var requestdata = new
            {
                securityToken = "securityToken",
                template = tempDetail 
            };
            
            string data2 = JsonConvert.SerializeObject(requestdata).ToString();            

            System.Net.WebClient webClient = new System.Net.WebClient();
            webClient.Headers["Content-type"] = "application/json";
            webClient.Encoding = Encoding.UTF8;
var strUpdTemplate = webClient.UploadString("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/TemplateRSService.svc/UpdateTemplate", "POST", data2);

Note:“strUpdTemplate” contains the output response as return values 

 

Response:

The response will be in JSON format like below:

{" CreateTemplateResult": {
   "result": true,
   "error_code": 1011,
   "Message": " Template Updated succesfully",
   “Response”: { “TemplateDetail response –
                              Template response updated Information will display” }
}}


 

 

Send Feedback