Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.Admin.WSTemplateListResponse GetTemplates( string securityToken, string orgCode )
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.
orgCode
- String[20] (Required) - Default 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 |
List <TemplateDetail> |
TemplateDetails object. |
Examples
C#
lblError.Text = ""; TemplateClient templateService = new TemplateClient("TemplateWSServiceHttpEndpoint"); string securityToken = txtToken.Text; ; string orgCode = txtOrgCode.Text; WSTemplateListResponse wSTemplateResponse = templateService.GetTemplates(securityToken, orgCode); 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:GetTemplates> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:orgCode>Group Org Code</ser:orgCode> </ser:GetTemplates> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetTemplatesResponse xmlns="http://SBTService/ServiceContracts/"> <GetTemplatesResult 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>1008</a:ErrorCode> <a:Message>Template list displayed successfully</a:Message> <a:Response> <a:TemplateDetail z:Id="i2"> <a:TemplateID>5</a:TemplateID> <a:Title>Valtech1 - 5 - MC</a:Title> <a:Subject>Group1</a:Subject> <a:Text>Template with variable {Misc1}</a:Text> <a:Description>desc</a:Description> </a:TemplateDetail> </a:Response> </GetTemplatesResult> </GetTemplatesResponse> </s:Body> </s:Envelope>
JAVA
TemplateWSService srv = new TemplateWSService(); ITemplate iTemplate = srv.getTemplateWSServiceHttpEndpoint1(); WSTemplateListResponse res = null; String securityToken = "securityToken"; String orgCode = "OrgCode"; try { res = iTemplate.getTemplates(securityToken, orgCode); }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' ); $response = $client->__soapCall('GetTemplates', array($param)); echo '<pre?>'; print_r($response); if($response->GetTemplatesResult->Result){ echo 'Message: '.$response->GetTemplatesResult->Message; } else { echo 'Message: '.$response->GetTemplatesResult->Message; } ?>
REST
Method: GET
Response:
The response will be in JSON format like below: {" GetTemplatesResult": { "result": true, "error_code": 1008, "Message": " Template List displayed succesfully", “Response”: { “List<TemplateDetail> response – Template response Information will display in a list” } }}