API documentation

The TwitterLeague API attempts to conform to the design principles of Representational State Transfer (REST). You’ll find that you can simply change the file extension on most any request to get results in the format of your choice.

TwitterLeague supports the following data formats: XML and JSON

Rate Limiting

At the moment the TwitterLeague API does not rate limit. But obviously this will have to change if my poor little server can't take the strain!

Error Messages

When the TwitterLeague API returns error messages, it does so in your requested format. For example, an error from an XML method might look like this:

<?xml version="1.0" encoding="UTF-8"?>
<error>
	<description>Reason for error</description>
</error>

Methods

There are currently two methods availible. The first one contains all the ways you can order a league (to be used with the league method.


Method: League

This method is used to return a list of all users in a league with the data set in the parameters.

URL: http://api.twitterleague.com/league/league_id.format
Example URL: http://api.twitterleague.com/league/8.xml?type=updates&order=asc
Formats: xml or json
Parameters:


Example Output (XML):
<?xml version="1.0" encoding="UTF-8"?>
<league id="8" generator="TwitterLeague" version="2" generator_href="http://twitterleague.com/">
<name>Diggnation</name>
<ordering>Updates</ordering>
<direction>Ascending</direction>
<date>2009-5-18</date>
<users>
<user>
<id>14130107</id>
<username>glennmc</username>
<full_name>glenn mcelhose</full_name>
<location>San Francisco</location>
<image>http://s3.amazonaws.com/twit....3929/GMighty_normal.jpg</image>
<follower_count>12174</follower_count>
<friend_count>237</friend_count>
<ratio>51.3671</ratio>
<updates>431</updates>
<signup_date>Wed, 12 Mar 2008 04:41:12 +0000</signup_date>
<position>1</position>
</user>
<user>
<id>791124</id>
<username>dlprager</username>
<full_name>David Prager</full_name>
<location>San Francisco</location>
<image>http://s3.amazonaws.com/twit....90950/Picture_5_normal.png</image>
<follower_count>22311</follower_count>
<friend_count>183</friend_count>
<ratio>121.918</ratio>
<updates>1060</updates>
<signup_date>Fri, 23 Feb 2007 17:10:26 +0000</signup_date>
<position>2</position>
</user>
<user>
<id>14413075</id>
<username>alexalbrecht</username>
<full_name>alexalbrecht</full_name>
<location>Los Angeles, CA</location>
<image>http://s3.amazonaws.com/twi....0513/My_Cube_normal.jpg</image>
<follower_count>62757</follower_count>
<friend_count>41</friend_count>
<ratio>1530.6585</ratio>
<updates>1936</updates>
<signup_date>Wed, 16 Apr 2008 22:21:00 +0100</signup_date>
<position>3</position>
</user>
<user>
<id>657863</id>
<username>kevinrose</username>
<full_name>Kevin Rose</full_name>
<location>San Francisco, CA</location>
<image>http://s3.amazonaws.com/twit....565477/ktea_normal.jpg</image>
<follower_count>633357</follower_count>
<friend_count>170</friend_count>
<ratio>3725.6294</ratio>
<updates>2521</updates>
<signup_date>Thu, 18 Jan 2007 00:43:32 +0000</signup_date>
<position>4</position>
</user>
</users>
</league>


Method: Ordering

This method is used to return a list of all ways of ordering a league.

URL: http://api.twitterleague.com/ordering.format
Example URL: http://api.twitterleague.com/ordering.xml
Formats: xml or json
No Parameters:
Example Output (XML):

<?xml version="1.0" encoding="UTF-8"?>
<ordering generator="TwitterLeague" version="2" generator_href="http://twitterleague.com/">
<order>
<name>Alphabetical by username</name>
<short_name>Alphabetical</short_name>
<api_parameter>alpha</api_parameter>
</order>
<order>
<name>Followers</name>
<short_name>Followers</short_name>
<api_parameter>followers</api_parameter>
</order>
<order>
<name>Following</name>
<short_name>Following</short_name>
<api_parameter>following</api_parameter>
</order>
<order>
<name>Updates</name>
<short_name>Updates</short_name>
<api_parameter>updates</api_parameter>
</order>
<order>
<name>Follower/Following ratio</name>
<short_name>Ratio</short_name>
<api_parameter>ratio</api_parameter>
</order>
<order>
<name>Signup date</name>
<short_name>Signup date</short_name>
<api_parameter>signup</api_parameter>
</order>
</ordering>

If you are having any problems with the API please contact me using the information on the contact page.