search

 

API Documentation

Introduction


The sayabit API allows developers to interact in a programmatic way with the sayabit website
Using the API, you can access all the functionalities of sayabit website. You can shorten a Long URL, get the information and statistics of the shortened URL.

Authentication

All API requests need two authentication parameters.
  • User
  • ApiKey

User is the username of your sayabit login and ApiKey is the unique Key provided to you. These values can be get in your Account page.

All your requests to the API should contains the above two parameters as query strings.

User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21

*Note : All the parameter names are case sensitive. "User" cannot be "user" or "USER". It should be "User" only.

REST API Methods


There are several REST API methods that can be used to acces the saybit API.

/shortme

Given a Long url, this will return a shor url.


Request Parameters

  • User
  • ApiKey
  • LongUrl ( *Must be URL escaped.)
  • CustomBit ( *Optional.)

Example:

http://sayabit.com/api/shortme?LongUrl=http://www.sayaglify.com/customer-showcase.html&CustomBit=demo&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21

In the above API request 'CustomBit' is the optional parameter. This is the custom name for your short URL. That is, your sayabit link will be generated as http://sayabit.com/<CustomBit>


Response

The successful response for the above request will be as follows.

<sayabit>
  <Response>
    <LongUrl>http://www.sayaglify.com/customer-showcase.html</LongUrl>
    <ShortUrl>http://sayabit.com/TSM0yE</ShortUrl>
    <bit>TSM0yE</bit>
    <CreatedBy>testapi</CreatedBy>
    <CreatedOn>2009-09-17 14:10:33 UTC</CreatedOn>
    <ExpiryOn>NA</ExpiryOn>
  </Response>
</sayabit>

The <ShortUrl> is the sayabit shortened URL for your Long URL and <bit> is the sayabit code for your Long URL
Anyone of these two can be used in the expand, info and stats API methods

Errors

If there is any error in the API request, you will get the response similar to below


The <Response> part will be empty and you will get an <Error> part. Check for the <Message> and <Code> <sayabit>
  <Error>
    <Message>CustomURL has already been taken</Message>
    <Code>106</Code>
    <Status>Failure</Status>
  </Error>
  <Response>
  </Response>
</sayabit>

Possible Error codes and messages

Code : 105
Message : LongURL is missing

Code : 106
Message : CustomURL has already been taken


/expand

Given a ShortUrl or bit, this will return a Long Url.


Request Parameters

  • User
  • ApiKey
  • ShortUrl (or) bit

Example:
http://sayabit.com/api/expand?bit=TSM0yE&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21
http://sayabit.com/api/expand?ShortUrl=http://sayabit.com/TSM0yE&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21

Response

The successful response for the above request will be as follows.

<sayabit>
  <Response>
    <LongUrl>http://www.sayaglify.com/customer-showcase.html</LongUrl>
    <ShortUrl>http://sayabit.com/TSM0yE</ShortUrl>
    <bit>TSM0yE</bit>
  </Response>
</sayabit>

Errors

If there is any error in the API request, you will get the response similar to below

The <Response> part will be empty and you will get an <Error> part. Check for the <Message> and <Code>

<sayabit>
  <Error>
    <Message>ShortURL or Bit is missing</Message>
    <Code>103</Code>
    <Status>Failure</Status>
  </Error>
  <Response>
  </Response>
</sayabit>

Possible Error codes and messages

Code : 103
Message : ShortURL or Bit is missing

Code : 104
Message : Invalid Short URL or bit


/info

Given a ShortUrl or bit, this will return complete information of the LongURL including MetaData information.


Request Parameters

  • User
  • ApiKey
  • ShortUrl (or) bit

Example:

http://sayabit.com/api/info?bit=TSM0yE&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21

http://sayabit.com/api/info?ShortUrl=http://sayabit.com/TSM0yE&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21


Response

The successful response for the above request will be as follows.

<sayabit>
  <Response>
    <LongUrl>http://www.sayaglify.com/customer-showcase.html</LongUrl>
    <ShortUrl>http://sayabit.com/TSM0yE</ShortUrl>
    <bit>TSM0yE</bit>
    <CreatedBy>testapi</CreatedBy>
    <CreatedOn>2009-09-17 14:10:33 UTC</CreatedOn>
    <ExpiryOn>NA</ExpiryOn>
    <ActiveFrom>NA</ActiveFrom>
    <TotalClicks>10</TotalClicks>
    <AggregateBit>TSM0yE</AggregateBit>
    <AggregateShortUrl>http://sayabit.com/TSM0yE</AggregateShortUrl>
    <AggregateTotalClicks>10</AggregateTotalClicks>
      <MetaData>
        <Title>Sayaglify | Hosted eCommerce Application</Title>
        <ContentType>text/html; charset=iso-8859-1</ContentType>
        <Description>
          We take care of hosting, bandwidth, and security, so you can focus on your Merchant's.</Description>
        <Keywords>
          <keyword>Sayaglify</keyword>
          <keyword>Sayagle</keyword>
          <keyword>Hosted eCommerce Application</keyword>
          <keyword>eCommerce Website</keyword>
          <keyword>Hosting sites</keyword>
          <keyword>Hosting</keyword>
          <keyword>Merchants</keyword>
          <keyword>Community Merchandising</keyword>
          <keyword>Publish your site</keyword>
          <keyword>Customize your site</keyword>
        </Keywords>
      </MetaData>
  </Response>
</sayabit>

Errors

If there is any error in the API request, you will get the response similar to below

The <Response> part will be empty and you will get an <Error> part. Check for the <Message> and <Code>

<sayabit>
  <Error>
    <Message>Invalid Short URL or bit</Message>
    <Code>104</Code>
    <Status>Failure</Status>
  </Error>
  <Response>
  </Response>
</sayabit>

Possible Error codes and messages

Code : 103
Message : ShortURL or Bit is missing

Code : 104
Message : Invalid Short URL or bit


/stats

Given a ShortUrl or bit, this will return complete statistics of the LongURL including total clicks, Last week traffic, Last month traffic and Location Wise traffic.


Request Parameters

  • User
  • ApiKey
  • ShortUrl (or) bit

Example:

http://sayabit.com/api/stats?bit=TSM0yE&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21

http://sayabit.com/api/stats?ShortUrl=http://sayabit.com/TSM0yE&User=testapi&ApiKey=b002bc8da8d08431f7cfe916211265387d6d6a21


Response

The successful response for the above request will be as follows.

<sayabit>
  <Response>
    <LongUrl>http://www.sayaglify.com/customer-showcase.html</LongUrl>
    <ShortUrl>http://sayabit.com/TSM0yE</ShortUrl>
    <bit>TSM0yE</bit>
    <CreatedBy>testapi</CreatedBy>
    <CreatedOn>2009-09-17 14:10:33 UTC</CreatedOn>
    <ExpiryOn>NA</ExpiryOn>
    <TotalClicks>10</TotalClicks>
      <LastWeekTraffic>
      </LastWeekTraffic>
      <LastMonthTraffic>
      </LastMonthTraffic>
      <LocationwiseTraffic>
      </LocationwiseTraffic>
  </Response>
</sayabit>

Errors

If there is any error in the API request, you will get the response similar to below

The <Response> part will be empty and you will get an <Error> part. Check for the <Message> and <Code>

<sayabit>
  <Error>
    <Message>Invalid Short URL or bit</Message>
    <Code>104</Code>
    <Status>Failure</Status>
  </Error>
  <Response>
  </Response>
</sayabit>

Possible Error codes and messages

Code : 103
Message : ShortURL or Bit is missing

Code : 104
Message : Invalid Short URL or bit


/fileUpload

Uploading a file, this will return a shor url.


Note:post data should be formatted as multipart/form-data.


Request Parameters

  • User
  • ApiKey
  • FileToupload (Binary image data or File object)
  • CustomBit ( *Optional.)

On uploading a file, this will give a short url. All file upload request to the API must be a file of below listed file type. The request must be http post and should be formatted as multipart/form-data.

Supported file types:
(.gif, .jpg, .png, .bmp, .jpeg, .doc, .docx, .pdf, .xls, .xlsx, .txt, .ppt, .pptx, .pos, .mpp, .pub, .psd, .mp4, .wmv, .flv, .m4v, .cda, .wv, .mus, .pcd, .pps, .rtf, .swf, .vob, .wav, .xml, .dwg)

Response

The successful response for this method will be as follows.

<sayabit>
<Response>
<FileToupload>my_desktop.png</FileToupload>
<ShortUrl>http://localhost:3000/raj/desk</ShortUrl>
<bit>raj/desk</bit>
<CreatedBy>raj</CreatedBy>
<CreatedOn>04/02/2010 02:59 PM</CreatedOn>
<ExpiryOn>NA</ExpiryOn>
<ActiveFrom>NA</ActiveFrom>
</Response>
</sayabit>

The <FileToupload> is the file uploaded through the request.

Errors

If there is any error in the API request, you will get the response similar to below

The <Response> part will be empty and you will get an <Error> part. Check for the <Message> and <Code>

<sayabit>
<Error>
<Message>File is missing</Message>
<Code>107</Code>
<Status>Failure</Status>
</Error>
<Response> </Response>
</sayabit>


Possible Error codes and messages

Code : 107
Message : File is missing

Code : 108
Message : File already exist

Code : 109
Message : Free space exceeded

Code : 110
Message : Error uploading your file, Please check file type

Code : 111
Message : Virus found in your file, Please upload a virus free file


Authentication Errors

To access all the API methods, you should be authenticated.


Possible Error codes and messages for Authentication

Code : 101
Message : Username or API Key is missing

Code : 102
Message : Authentication failed

Sayabit Tools

  • BookmarkletsBrowser Bookmarklet
    Drag this to your browser toolbar to shorten URLs from anywhere.
  • BookmarkletsAPI
    Use API to interact programmatically with Sayabit.Shorten an URL and get traffic, conversations, and history.
Powered by :Powered by Sayagle