Overview
Returns the Short URLs based on input Long URLs and domain configured at SBT side.
Note: In one request maximum 100 Short URLs can be generated.
Syntax
C#
[OperationContractAttribute()] SBT.API.DataContracts.Admin.WSShortURLsMappingResponse GetShortURLs( string securityToken, List<string> longURLs, 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
longURLs
- String[1100] (Required) – Long URL which needs to be Shorten. Multiple Long URLs can be entered as array. Limited to 100 Long URLs.
orgCode
- String[20] (Required) - Organization Code for the group, division, organization.
Domain
- String[20] (Optional) – Domain to which Short URL to be generated
Return Value
WSGetShortURLsResponse
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 the Error code. |
Response |
<a:ShortURLMapping> |
List of Response parameters, These will be displayed repeatedly based on number of input Long URLs. LongURL- Long URL passed in request to get Short URL. ShortURL - Short URL generated based on Long URL and domain passed in request. |
Example
C#
lblError.Text = ""; SmartClickClient smartClickResult = new SmartClickClient("SmartClickWSServiceHttpEndpoint"); string securityToken = txtToken.Text; string orgCode = txtOrgCode.Text; List<string> longURLs = new List<string>() { longURL1, longURL2 }; string domain = txtDomain.Text; WSShortURLsMappingResponse wSResponse = smartClickResult.GetShortURLs(securityToken, longURLs, string orgCode, string domain); if (!wSResponse.Result) { //handle error lblError.Text = wSResponse.Message; } else { //handle success lblError.Text = wSResponse.Message; }
SOAP
Soap Request <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <soapenv:Header/> <soapenv:Body> <ser:GetShortURLs> <!--Required:--> <ser:securityToken>Security Token</ser:securityToken> <!--Required:--> <ser:longURLs> <!--Zero or more repetitions:--> <arr:string>http://www.LURL01.com</arr:string> <arr:string>http://www.LURL02.com</arr:string> </ser:longURLs> <!--Required:--> <ser:orgCode>Organization Code</ser:orgCode> <!--Optional:--> <ser:domain>Valid Domain name</ser:domain> </ser:GetShortURLs> </soapenv:Body> </soapenv:Envelope> Soap Response <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetShortURLsResponse xmlns="http://SBTService/ServiceContracts/"> <GetShortURLsResult 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:ShortURLMapping> <a:LongURL>http://www.LURL01.com</a:LongURL> <a:ShortURL>sclk.me/2K2DQJ2</a:ShortURL> </a:ShortURLMapping> <a:ShortURLMapping> <a:LongURL>http://www.LURL02.com</a:LongURL> <a:ShortURL>sclk.me/2K7U5EH</a:ShortURL> </a:ShortURLMapping> </a:Response> </GetShortURLsResult> </GetShortURLsResponse> </s:Body> </s:Envelope>
Response:
The response will be in JSON format as below: { "GetShortURLsResult": { "Result": true, "ErrorCode": 1528, "Message": "Successfully generated the shortURL.", "Response": [ { "LongURL": " http://www.test.com", "ShortURL": "sclk.me/2JEJ8Kq" }, { "LongURL": " http://www.test2.com", "ShortURL": "sclk.me/2JEAPOC" } ] } }