Overview
Get the Organization tree for a specified org code.
Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.Admin.WSOrganizationTreeResponse GetOrgTree( string securityToken, string orgCode)
WSDL
Production: https://ui.solutionsbytext.com/Sbt.App.SetUp/wsservices/GeneralWSService.svc?singlewsdl
Staging: https://test.solutionsbytext.com/Sbt.App.SetUp/wsservices/GeneralWSService.svc?singlewsdl
Parameters
securityToken
- String[1000] (Required) - SecurityToken to authenticate the user
orgCode
- String[20] (Required) - Organization Code for the group, division, organization or tenant.
Return Value
WSOrganizationTreeResponse
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 | WSOrganization | List out the organization tree based on the Organization Code provided in the GetOrgTree function. |
Example
C#
lblError.Text = ""; GroupClient generalService = new GroupClient("ReportWSServiceHttpEndpoint2"); string securityToken = txtToken.Text; string orgCode = txtOrgCode.Text; WSOrganizationTreeResponse wSOrganizationTreeResponse = generalService.GetOrgTree(securityToken, orgCode); if (!wSOrganizationTreeResponse.Result) { //handle error lblError.Text = wSOrganizationTreeResponse.Message; } else { //handle success lblError.Text = wSOrganizationTreeResponse.Message; }
SOAP
Soap Request <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/"> <soapenv:Header/> <soapenv:Body> <ser:GetOrgTree> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:orgCode>Org Code</ser:orgCode> </ser:GetOrgTree> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetOrgTreeResponse xmlns="http://SBTService/ServiceContracts/"> <GetOrgTreeResult 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>1443</a:ErrorCode> <a:Message>Successfully loaded organization tree</a:Message> <a:Response z:Id="i2"> <a:OrgStructureName>OrgName</a:OrgStructureName> <a:OrgCode>OrgCode</a:OrgCode> <a:CommunicationCode>12345</a:CommunicationCode> <a:EmailID/> <a:Address/> <a:Street/> <a:ZipCode/> <a:PhoneNo/> <a:City/> <a:State>abcd</a:State> <a:StateAbbr>ab</a:StateAbbr> <a:Country>AAAA</a:Country> <a:ContactFName/> <a:ContactLName/> <a:ContactPhoneNo/> <a:ContactMobilePhoneNo/> <a:ContactEmailID/> <a:URL/> <a:organization/> <a:Group> <a:GroupWS z:Id="i3"> <a:GroupCode>GroupCode</a:GroupCode> <a:GroupName>GroupName</a:GroupName> <a:IsSubscriptionPublic>1</a:IsSubscriptionPublic> <a:StackOrder>0</a:StackOrder> <a:CommunicationCode>12345</a:CommunicationCode> <a:Keyword> <a:KeywordWS z:Id="i4"> <a:KeywordCode>keywordCode</a:KeywordCode> <a:KeyWordName>KeyWordName</a:KeyWordName> <a:KeywordNote/> <a:KeywordResponse>sd</a:KeywordResponse> <a:CallbackURL/> <a:App_Identifier>0</a:App_Identifier> <a:SubscribedResponse>You are already subscribed to thu group</a:SubscribedResponse> <a:Active>2</a:Active> <a:KeywordTypeID>3</a:KeywordTypeID> <a:KeywordType>Premium</a:KeywordType> <a:IsAutoSubscribe>0</a:IsAutoSubscribe> </a:KeywordWS> </a:Keyword> </a:GroupWS> </a:Group> </a:Response> </GetOrgTreeResult> </GetOrgTreeResponse> </s:Body> </s:Envelope>
JAVA
GeneralWSService srv = new GeneralWSService(); //Interface is IGeneral and interface name is IGroup . IGroup iGroup = srv.getReportWSServiceHttpEndpoint1(); WSOrganizationTreeResponse res = null; String securityToken = "securityToken"; String orgCode = "orgCode"; try { res = iGroup.getOrgTree(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/GeneralWSService.svc?wsdl"); $param = array( 'securityToken' => 'securityToken', 'orgCode' => 'orgCode' ); $response = $client->__soapCall('GetOrgTree', array($param)); echo '<pre/>'; print_r($response); if($response->GetCellularCarrierResult->Result){ echo 'Message: '.$response->GetCellularCarrierResult->Message; } else { echo 'Message: '.$response->GetCellularCarrierResult->Message; } ?>
PHP
Method: GET
URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/GeneralRSService.svc/GetOrgTree?securityToken={security token} &orgCode={org. code}
Response:
The response will be in JSON format like below: {" GetOrgTreeResult": { "Result": true, "ErrorCode": 1443, "Message": " Successfully loaded organization tree", “Response”: { “WSOrganization response - Org Tree data will display here in JSON format” } }}