Twitter changes the retweet API
September 30, 2009 at 10:17 PM by Dr. Drang
…and ruined the changes I made last week to Dr. Twoot. This little bomb dropped a few hours ago. The changes don’t appear to be in the calls your program makes, but are in the organization of the data that are returned. In a nutshell, the positions of the original tweet and the retweet have been reversed in the hierarchy.
Originally, a retweet would return something like this (in XML format):
<status>
<created_at>Fri Jun 19 22:36:52 +0000 2009</created_at>
<id>2245071380</id>
<text>Last night I dreamt that I was watching a film about someone who gradually realized they were retweeting their own death.</text>
…[snip]…
<user>
<id>25753325</id>
<name>Prabhakar Ragde</name>
<screen_name>plragde</screen_name>
…[snip]…
</user>
<retweet_details>
<retweet_id>2245122541</retweet_id>
<retweeted_at>Fri Jun 19 22:41:13 +0000 2009</retweeted_at>
<retweeting_user>
<id>3191321</id>
<name>Marcel Molina</name>
<screen_name>noradio</screen_name>
…[snip]…
</retweeting_user>
</retweet_details>
</status>
Note that the original tweet, the one with the smaller id
, and its author are at the root level of the status
and the retweet is buried one level deeper. Now see an example of what that’s been changed to:
<status>
<created_at>Thu Sep 24 19:41:53 +0000 2009</created_at>
<id>4349744308</id>
<text>RT @Schwarzenegger: About to go on right now to talk about AB32 and climate change. Watch at http://tweetcast.in</text>
…[snip]…
<retweeted_status>
<created_at>Thu Sep 24 19:03:30 +0000 2009</created_at>
<id>4348912569</id>
<text>About to go on right now to talk about AB32 and climate change. Watch at http://tweetcast.in</text>
…[snip]…
<user>
<id>12044602</id>
<name>Gov. Schwarzenegger</name>
<screen_name>Schwarzenegger</screen_name>
…[snip]…
</user>
</retweeted_status>
<user>
<id>44940026</id>
<name>Anita Doller</name>
<screen_name>testiverse</screen_name>
…[snip]…
</user>
</status>
The retweet and retweeter are now at the root level and the original is one level deeper.
This is a significant change. It’s not that it’s much harder to program for the new return values—it isn’t—but those of us who were anticipating the first hierarchy (which is what the API docs are still showing as I write this) will find our earlier work at odds with the new system.
I’ve created a new branch of Dr. Twoot, called retweet, to handle this latest change. I haven’t tested it fully, and probably can’t until the new retweeting goes live, but I doubt it has too many bugs. It’s working fine with the current home_timeline
, anyway.
Regarding a somewhat more popular Twitter client, Loren Brichter announced this morning that the final build of Tweetie 2 was submitted to the App Store yesterday. I hope the Twitter folks gave him a heads-up about this change. If not, I bet we’ll be seeing 2.1 (but not paying for it) close on 2’s heels.