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 succesfull 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 succesfull 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 succesfull 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, Laste week traffic, Last month traffic and Locationwise 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 succesfull 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

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