Twitter API Ditches XML For Trends: New Features Are JSON-Only

Twitter is embracing the trend where 1 in 5 new APIs do not support XML. The trend is playing out, appropriately enough, with Twitter's Endpoint for accessing global and local trending topics. It follows a move in late 2010 where Twitter Streaming went JSON-only. All signs point to no XML support for new Twitter features. The move to JSON is brought on by Twitter's consolidation of the three separate endpoints for accessing trends into a single endpoint. The one solution is built off of Yahoo's WOEIDs (Where on Earth IDs). WOEIDs have been the basis of location-related Twitter calls since Twitter originally released location trends nearly two years ago. The identifiers were also central to the Mixer Labs' GeoAPI acquired by Twitter in late 2009. Global trends will still be available using a WOEID of 1. Twitter's Jason Costa explained why Twitter is removing XML:

As well as standardizing the trends URL we are also planning to switch the trends API to JSON only. The reason for this is because the use of XML on the trends API is significantly low and removing support would allow us to free up resources for other developments.

Running down the data formats supported by Twitter's various APIs, there is still plenty of XML support (as well as RSS and Atom), but some of the newer features are JSON-only.
Twitter API Data Formats

Twitter API
  • Home timeline, favorites and direct messages
  • Geo, trends
  • Individual statuses, retweets, followers/friends, users, lists, etc.
Twitter Search APIJSON, Atom
Twitter Streaming API
  • User streams, site streams

As we wrote then the JSON-only Streaming API was announced, it seems clear that XML does not have much future at Twitter, at least with new features. Since so many applications count upon some of the oldest Twitter functionality, such as the core timeline, we'd expect XML to be supported for awhile, if not indefinitely. That said, Twitter hasn't shied away from forcing developers to make updates before. After several delays, Twitter shut off basic authentication one year ago. Most recently the company implemented changes for applications accessing direct messages.
Via Ryan Sarver

Be sure to read the next API Design article: REST API Design: Put the "Type" in "Content-Type"