Get Short URL

Returns the Short URL based on input Long URL and domain configured at SBT side.

Overview

Returns the Short URL based on input Long URL and domain configured at SBT side.

 

Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.Admin.WSShortURLMappingResponse GetShortURL(
String securityToken, 
string longURL, 
string orgCode, 
string domain
);

 

 

WSDL

Production: https://ui.solutionsbytext.com/SBT.App.SetUp/wsservices/SmartclickWSService.svc?singlewsdl

Staging: https://test.solutionsbytext.com/SBT.App.SetUp/wsservices/SmartclickWSService.svc?singlewsdl

 

 

Parameters

securityToken

– String[1000] (Required) – Security Token to authenticate the user

longURL

– String[1100] (Required) – URL needs to be Shorten.

orgCode

– String[20] (Required) – Organization Code for the group, division, organization. OrgCode is a required field for software partner but not for Tenant customer type.

Domain

– String[20] (Optional) – Domain to which Short URL to be generated. If no domain passed, then it will take the default domain.

 

Return Value

WSGetShortURLResponse
NameTypeDescription
ResultboolTrue/False wether the cell was successful or not.
ErrorCodeintFor Success/Failure it returns an error number.
MessagestringMessage related to error code.
Response 

List of Response parameters,

LongURL– Long URL passed in request to get Short URL.
ShortURL – Short URL generated based on Long URL and domain passed in request.
DisplayMessage – This parameter will be displayed only in case of errors. For.eg. Invalid domain etc.

 

Example

C#

lblError.Text = "";
SmartClickClient smartClickResult = new SmartClickClient("SmartClickWSServiceHttpEndpoint");
	string securityToken = txtToken.Text;
	string longURL = txtLongURL.Text;
	string orgCode = txtOrgCode.Text;
	string domain = txtDomain.Text;
 
WSShortURLMappingResponse wSShortURLMappingResponse = smartClickResult.GetShortURL(securityToken, longURL, orgCode, domain);
        if (!wSShortURLMappingResponse.Result)
            {
                //handle error
                lblError.Text = wSShortURLMappingResponse.Message;                
            }
        else
            {
                //handle success
                lblError.Text = wSShortURLMappingResponse.Message;
            }

SOAP

Soap Request 
  
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:GetShortURL>
         <!-- Required:-->
         <ser:securityToken>Security Token </ser:securityToken>
         <!-- Required:-->
         <ser:longURL>http://www.test.com</ser:longURL>
         <!-- Required:-->
         <ser:orgCode>Org Code</ser:orgCode>
         <!--Optional:-->
         <ser:domain>domain</ser:domain>
      </ser:GetShortURL>
   </soapenv:Body>
</soapenv:Envelope>
 
             
Soap Response
              
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetShortURLResponse xmlns="http://SBTService/ServiceContracts/">
         <GetShortURLResult xmlns:a="http://SBTAPIService/DataContract/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:Result>true</a:Result>
            <a:ErrorCode>1528</a:ErrorCode>
            <a:Message>Successfully generated the shortURL.</a:Message>
            <a:Response>
               <a:LongURL>http://www.test.com</a:LongURL>
               <a:ShortURL>Sclk.me/2jjhYNv</a:ShortURL>
            </a:Response>
         </GetShortURLResult>
      </GetShortURLResponse>
   </s:Body>
</s:Envelope>

 

Rest

Method: GET

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/SmartClickRSService.svc/GetShortURL?securityToken=SecurityToken&longURL=http://www.test.com&orgCode=OrgCode&domain=sclk.me

Response: 

The response will be in JSON format like below:
 
{
    "GetShortURLResult": {
        "Result": true,
        "ErrorCode": 1528,
        "Message": "Successfully generated the shortURL.",
        "Response": {
            "LongURL": "http://www.test.com",
            "ShortURL": "Sclk.me/2A7jNp4"
        }
    }
}

 

Send Feedback

Back to all documentation