Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.Admin.WSTemplateResponse ReadTemplate( string securityToken, string orgCode, int templateID )
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) - Security Token to authenticate the user.
orgCode
- String[20] (Required) - Default Organization Code of the group.
templateID
- int (Required) - ID of the template to be read.
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; ; string orgCode = txtOrgCode.Text; int templateId = Convert.ToInt32(txtTemplateID.Text.Trim()); WSTemplateResponse wSTemplateResponse = templateService.ReadTemplate(securityToken, orgCode, templateId); 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/"> <soapenv:Header/> <soapenv:Body> <ser:ReadTemplate> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:orgCode>Org code of the Group</ser:orgCode> <!--Required:--> <ser:templateID>Template ID</ser:templateID> </ser:ReadTemplate> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <ReadTemplateResponse xmlns="http://SBTService/ServiceContracts/"> <ReadTemplateResult 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>1012</a:ErrorCode> <a:Message>Template exists</a:Message> <a:Response z:Id="i2"> <a:TemplateID>2</a:TemplateID> <a:Title>Title of the template</a:Title> <a:Subject>Subject of the template</a:Subject> <a:Text>Template message for T2C API automation. With custom variable {text1}</a:Text> <a:Description>description of template</a:Description> </a:Response> </ReadTemplateResult> </ReadTemplateResponse> </s:Body> </s:Envelope>
JAVA
TemplateWSService srv = new TemplateWSService(); ITemplate iTemplate = srv.getTemplateWSServiceHttpEndpoint1(); WSTemplateResponse res = null; String securityToken = "securityToken"; String orgCode = "orgCode"; Integer templateID = 101; try { res = iTemplate.readTemplate(securityToken, orgCode, templateID); } 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', 'orgCode' => 'orgCode', 'templateID' => '21' ); $response = $client->__soapCall('ReadTemplate', array($param)); echo '<pre?>'; print_r($response); if($response->ReadTemplateResult->Result){ echo 'Message: '.$response->ReadTemplateResult->Message; } else { echo 'Message: '.$response->ReadTemplateResult->Message; } ?>
REST
Method: GET
Response:
The response will be in JSON format like below: {" ReadTemplateResult": { "result": true, "error_code": 1008, "Message": " Template List displayed succesfully", “Response”: { “TemplateDetail response – TemplateDetail response Information will display” } }}