Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sqwi/public_html/api/index.php:3) in /home/sqwi/public_html/cookies.php on line 7

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sqwi/public_html/api/index.php:3) in /home/sqwi/public_html/cookies.php on line 7

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/class.geshi.php on line 703

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/class.geshi.php on line 723

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/geshi/classes/class.geshistyler.php on line 250

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/geshi/classes/class.geshistyler.php on line 260

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/geshi/classes/class.geshicontext.php on line 391

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/geshi/classes/class.geshicontext.php on line 433

Deprecated: Assigning the return value of new by reference is deprecated in /home/sqwi/public_html/api/geshi/geshi/classes/class.geshicontext.php on line 449
sqwi.sh | API
 

API


The sqwi.sh API is here and available now. It is still in BETA, but I've been hammering it for a while now, so it should be pretty solid. I've had a few 3rd-party apps pointing at it too, and they seem happy...

The basic structure of the endpoint is:

http://api.sqwi.sh/{method}.{format}?{params}

At this stage there are three methods:

which do exactly what their names indicate, just as they perform on the site itself.

There are two response formats available (JSON and XML), the structure of these is clarified for each method below.

At this stage there will not be enforcement of the requirement for an API key (developer key) while in BETA, however this will change in the future, so please request one now and use it so that you are prepared. There will be an email to all registered key holders prior to enforcement beginning so that you can ensure your usage is compliant.

shorten

[return to top]

This is the base method that every user of the API will need access to. The parameters for this are:

  • api_key [mandatory] - your application or site's key, as per above. Sign up here
  • url [mandatory] - the URL to be shortened
  • custom [optional] - a custom code for your sqwish'd link, if desired
  • password [optional] - password protect the statistics and ips for the shortened URL, if desired

Usage is:

http://api.sqwi.sh/shorten.{xml | json}?api_key={APIKEY}&url={LONGURL}[&custom={CUSTOMCODE}][&password={PASSWORD}]

eg. for XML:

http://api.sqwi.sh/shorten.xml?api_key=APIKEY&url=http://www.example.com

returns:

<?xml version="1.0" encoding="UTF-8"?>
<sqwish>
<error>false</error>
<original>http://www.example.com</original>
<shortURL>http://sqwi.sh/kFZ</shortURL>
<code>kFZ</code>
<custom>false</custom>
<password>false</password>
</sqwish>

and for JSON:

http://api.sqwi.sh/shorten.json?api_key=APIKEY&url=http://www.example.com

returns:

{
"error":"false",
"original":"http:\/\/www.example.com",
"shortURL":"http:\/\/sqwi.sh\/kFZ",
"code":"kFZ",
"custom":"false",
"password":"false"
}

stats

[return to top]

This method retrieves the hit count statistics for the URL. The parameters for this are:

  • api_key [mandatory] - your application or site's key, as per above. Sign up here
  • code [mandatory] - the code for the shortened URL
  • password [optional] - the password for access to the statistics and ips for the shortened URL, if set

Usage is:

http://api.sqwi.sh/stats.{xml | json}?api_key={APIKEY}&code={CODE}[&password={PASSWORD}]

eg. for XML:

http://api.sqwi.sh/stats.xml?api_key=APIKEY&code=kFZ

returns:

<?xml version="1.0" encoding="UTF-8"?>
<sqwish>
<error>false</error>
<original>http://www.example.com</original>
<shortURL>http://sqwi.sh/kFZ</shortURL>
<code>kFZ</code>
<hits>16</hits>
</sqwish>

and for JSON:

http://api.sqwi.sh/stats.json?api_key=APIKEY&code=kFZ

returns:

{
"error":"false",
"original":"http:\/\/www.example.com",
"shortURL":"http:\/\/sqwi.sh\/kFZ",
"code":"kFZ",
"hits":"16"
}

ips

[return to top]

This method retrieves all, or some, of the IP addresses which have accessed the URL. The parameters for this are:

  • api_key [mandatory] - your application or site's key, as per above. Sign up here
  • code [mandatory] - the code for the shortened URL
  • limit [optional] - the maximum number of results to return for the shortened URL, these will be the most recent results
  • password [optional] - the password for access to the statistics and ips for the shortened URL, if set

Usage is:

http://api.sqwi.sh/ips.{xml | json}?api_key={APIKEY}&code={CODE}[&limit={LIMIT}][&password={PASSWORD}]

eg. for XML:

http://api.sqwi.sh/ips.xml?api_key=APIKEY&code=kFZ

returns:

<?xml version="1.0" encoding="UTF-8"?>
<sqwish>
<error>false</error>
<original>http://www.example.com</original>
<shortURL>http://sqwi.sh/kFZ</shortURL>
<code>kFZ</code>
<hits>16</hits>
<limit>false</limit>
<iplist>
	<ipdata><ip>65.52.22.174</ip><date>2011-07-17 18:22:49</date></ipdata>
	<ipdata><ip>74.112.131.128</ip><date>2011-07-17 18:19:06</date></ipdata>
	<ipdata><ip>75.101.180.85</ip><date>2011-07-17 18:18:07</date></ipdata>
	<ipdata><ip>204.236.254.109</ip><date>2011-07-17 18:17:07</date></ipdata>
	<ipdata><ip>65.52.6.105</ip><date>2011-07-17 18:16:47</date></ipdata>
	<ipdata><ip>75.101.173.99</ip><date>2011-07-17 18:16:43</date></ipdata>
	<ipdata><ip>89.151.116.52</ip><date>2011-07-17 18:16:43</date></ipdata>
	<ipdata><ip>67.195.115.50</ip><date>2011-07-17 18:16:42</date></ipdata>
	<ipdata><ip>72.30.161.232</ip><date>2011-07-17 18:16:42</date></ipdata>
	<ipdata><ip>50.18.121.34</ip><date>2011-07-17 18:16:41</date></ipdata>
	<ipdata><ip>184.72.47.46</ip><date>2011-07-17 18:16:41</date></ipdata>
	<ipdata><ip>184.72.25.232</ip><date>2011-07-17 18:16:40</date></ipdata>
	<ipdata><ip>72.30.161.232</ip><date>2011-07-17 18:16:40</date></ipdata>
	<ipdata><ip>199.59.149.31</ip><date>2011-07-17 18:16:40</date></ipdata>
	<ipdata><ip>199.59.149.165</ip><date>2011-07-17 18:16:39</date></ipdata>
	<ipdata><ip>38.113.234.180</ip><date>2011-07-17 18:16:39</date></ipdata>
</iplist>
</sqwish>

and for JSON:

http://api.sqwi.sh/ips.json?api_key=APIKEY&code=kFZ

returns:

{
"error":"false",
"original":"http:\/\/www.example.com",
"shortURL":"http:\/\/sqwi.sh\/kFZ",
"code":"kFZ","hits":"16",
"iplist":{
    "ipdata":{"ip":"65.52.22.174","date":"2011-07-17 18:22:49"},
    "ipdata":{"ip":"74.112.131.128","date":"2011-07-17 18:19:06"},
    "ipdata":{"ip":"75.101.180.85","date":"2011-07-17 18:18:07"},
    "ipdata":{"ip":"204.236.254.109","date":"2011-07-17 18:17:07"},
    "ipdata":{"ip":"65.52.6.105","date":"2011-07-17 18:16:47"},
    "ipdata":{"ip":"75.101.173.99","date":"2011-07-17 18:16:43"},
    "ipdata":{"ip":"89.151.116.52","date":"2011-07-17 18:16:43"},
    "ipdata":{"ip":"67.195.115.50","date":"2011-07-17 18:16:42"},
    "ipdata":{"ip":"72.30.161.232","date":"2011-07-17 18:16:42"},
    "ipdata":{"ip":"50.18.121.34","date":"2011-07-17 18:16:41"},
    "ipdata":{"ip":"184.72.47.46","date":"2011-07-17 18:16:41"},
    "ipdata":{"ip":"184.72.25.232","date":"2011-07-17 18:16:40"},
    "ipdata":{"ip":"72.30.161.232","date":"2011-07-17 18:16:40"},
    "ipdata":{"ip":"199.59.149.31","date":"2011-07-17 18:16:40"},
    "ipdata":{"ip":"199.59.149.165","date":"2011-07-17 18:16:39"},
    "ipdata":{"ip":"38.113.234.180","date":"2011-07-17 18:16:39"}
    }
}
 
Find more freelance jobs on Freelancer.com