Mark Lozano (also of TechBrew) and I have been working on a Twitter-related experiment that we’ll reveal sooner or later.
In the meantime, I found a couple of undocumented (or at least really obscure) Twitter features that may prove useful to developers:
1) RSS feeds can also be JSON
At the bottom of a Twitter profile page is an RSS link with a URL that looks like this:
http://twitter.com/statuses/user_timeline/816092.rss
(The number in the URL is your member id, incidentally.) If you would like to write a client-site app which consumes that content as JSON instead of RSS, simply change the feed extension from “.rss” to “.json”:
http://twitter.com/statuses/user_timeline/816092.json
2) JSON with Ajax callbacks
It gets better: Twitter also lets you specify a method callback on any JSON feed. So if you’re doing Ajax with dynamic script tags, add your script’s method name to the URL like so:
http://twitter.com/statuses/user_timeline/ 816092.json?callback=statusCallback
When your script has finished loading the JSON, it will automatically call your method. If this approach to Ajax is unfamiliar to you, check it out ASAP, since you can do cross-domain requests without the need for a server-side proxy.
If you look carefully at the Twitter JavaScript badges, you’ll see how this works.
3) Specify item counts in both RSS and JSON
Marjolein Hoekstra at CleverClogs was wishing for RSS feeds that had more status items than the default. As it turns out, you can specify a count on either an RSS url or a JSON one:
http://twitter.com/statuses/user_timeline/816092.rss?count=19
http://twitter.com/statuses/user_timeline/816092.json?count=2
The resulting RSS or JSON will only have the number of status messages that you have specified. And yes, you can combine the callback parameter with the count, like so:
http://twitter.com/statuses/user_timeline/ 816092.json?callback=statusCallback&count=23;
Happy tweeting!

Email

4 responses so far ↓
1 Mark Woodman // Mar 18, 2007 at 9:51 pm
Marjolein tells me the count parameter isn’t always reliable. If anyone compiles a “where it always works, where is sometimes works, where it never works” list, let me know.
2 Twitter Forum // Apr 4, 2007 at 5:23 pm
We have linked back to your article from our Twitter Community site.
http://www.twitterforum.com
3 Omar // May 1, 2008 at 12:55 pm
Thank you for the exaustive list of RSS, XML, and JSON ways to access. I’ll add one more to your list.
You can use the nickname of the user instead of the ID.
The following will work:
http://twitter.com/statuses/user_timeline/invassive.json
That can be useful when you want the user to enter their nickname.
4 Alan // May 31, 2009 at 3:50 pm
there is a similar json/rss feed of searches like this – tho the json is structured differently to the user_timeline
http://search.twitter.com/search.json?q=%23BGT&callback=twitterCallback2&count=8
(escaping the hash tag as %23 there)
Leave a Comment