The marriage between geographic context and real-time communication continues, as Twitter has indicated that its new “Trends API” will support queries for trends in a particular location. According to Raffi Krikorian of the Twitter Platform Team:
The one feature request that we’ve heard over and over, however, is
“what’s going on where I am?”. To answer that, we wanted to give you
all a heads up regarding the new “Trends API” that we’re launching.
This API will open up trending information that is specific to a
number of locations around the world.
At a high level, there will be two new endpoints:
- an endpoint to give a listing of all locations that trends are
available for, and
- an endpoint to actually allow you to query by a specific location.
As with Twitter’s other APIs, the Trends API is a RESTful API that returns results in both XML and JSON. Twitter has decided to utilize Yahoo’s Where on Earth IDs (WOEIDs) to identify locations for which it has trending data. WOEIDs are unique identifiers for place names around the world (see our additional coverage of WOEIDs and Yahoo’s Placemaker API for more information).
Using the trends available method will retrieve an array that includes WOEIDs (and related place name information such as name and place type) for trending locations. The top 10 trends for a location can be retrieved using the trends location method with a particular WOEID.
This information is cached for five minutes, and therefore users are discouraged from querying these endpoints faster than once every five minutes. Developers can also use a WOEID of “1″ to get global trending results. Also note that location-based trends will not be rolled up into daily and weekly trends (for the time being).
Twitter’s move to support location-based trends is sure to give developers an opportunity to further enhance existing mashups and applications that utilize Twitter’s API. The move also highlights the value that geographic context provides for real-time information, especially on a platform that has gained as much momentum as Twitter.
[Hat tip TechCrunch].