Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.Admin.WSTemplateResponse DeleteTemplate( 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) - SecurityToken to authenticate the user.
orgCode
- String[20] (Required) - Default Organization Code for the group from where template is to be deleted.
templateID
- int (Required) - TemplateId of the template which is to be deleted.
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. |
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.DeleteTemplate(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:DeleteTemplate> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:orgCode>Group Org Code</ser:orgCode> <!--Required:--> <ser:templateID>Template ID</ser:templateID> </ser:DeleteTemplate> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <DeleteTemplateResponse xmlns="http://SBTService/ServiceContracts/"> <DeleteTemplateResult 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>1009</a:ErrorCode> <a:Message>Template deleted successfully</a:Message> <a:Response z:Id="i2"/> </DeleteTemplateResult> </DeleteTemplateResponse> </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.deleteTemplate(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('DeleteTemplate', array($param)); echo '<pre?>'; print_r($response); if($response->DeleteTemplateResult->Result){ echo 'Message: '.$response->DeleteTemplateResult->Message; } else { echo 'Message: '.$response->DeleteTemplateResult->Message; } ?>
REST
Method: DELETE
URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/TemplateRSService.svc/DeleteTemplate
Sample C# Code:
var requestdata = new { securityToken = "validsecurityToken", orgCode = "orgCode", templateID = 1 }; string data2 = JsonConvert.SerializeObject(requestdata).ToString(); txtRequestFormat.Text = data2; System.Net.WebClient webClient = new System.Net.WebClient(); webClient.Headers["Content-type"] = "application/json"; webClient.Encoding = Encoding.UTF8; var strDelResponse = webClient.UploadString("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/TemplateRSService.svc/DeleteTemplate", "DELETE", data2); Note: “strDelResponse” contains the response which is in JSON format.
Response:
The response will be in JSON format like below: {" DeleteTemplateResult": { "result": true, "error_code": 1009, "Message": " Template Deleted succesfully" }}