Getting started with APIs: using the Twitter API

Leave a comment

July 18, 2011 by MMIT

API is one of those abbreviations that’s thrown around a lot but can seem a bit abstract.  Application Programming Interfaces (APIs) basically define a way for you to interact with a particular application (All clear now? No?). The best way to get your head around what this actually means is to use an API for something.

The Nerdary has a clear introductory guide to APIs, using the Twitter API. And the Twitter API really is a great place to start.

While Twitter may have bumped RSS off the homepage, you can still subscribe to Twitter using the API and, using Yahoo Pipes, combine and filter these feeds (and even clean up the data a little). This is a particularly handy way of monitoring feedback and mentions on Twitter and combining these into a super social media feed.

The Twitter API documentation will provide generic URLs as a guide which you can then use as RSS feeds in Yahoo Pipes (for example).

For starters to subscribe to a Twitter user’s lists:

http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=NAMEGOESHERE

(If you have any problems, there are always cheats available).

You can also subscribe to a Twitter search using the following format
http://search.twitter.com/search.atom?q=searchterm

There’s also a Basic Twitter Scraper available on ScraperWiki which you can fork to use as the basis of more advanced Twitter searches – but that might be a story for another time.

Lists are a little bit trickier but provide a way to subscribe to the timeline of all the list members.

To subscribe to a list created by a user requires the list ID parameter or slug (based on the username of the list creator)

http://api.twitter.com/1/micahvandegrift/lists/library-museum-archives/statuses.atom

http://api.twitter.com/version/lists/statuses.format

So, for example, if the list was created by the East of England CILIP group and the list is called eofe-info-pros (with the original list URL something like: http://twitter.com/#!/cilipeoe/eofe-info-pros), then your rss link for the status feed would be:

http://api.twitter.com/1/cilipeoe/lists/eofe-info-pros/statuses.atom

and similarly, for memberships the format looks like this:
http://api.twitter.com/version/lists/memberships.format

and our example feed would be:

http://api.twitter.com/1/cilipeoe/lists/eofe-info-pros/memberships.atom

There’s obviously a lot more you can do with the API than this — for example, this  guide shows you how to adds location info to a Twitter feed in Yahoo Pipes.  The Twitter fan wiki also has lots of sample apps and mashups to browse through.

And while the Twitter API is a good place to start, there are plenty of library-related APIs to try, such as:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

MmIT logo

About

The MmIT group is a CILIP special interest group concerned with the organisation, delivery and exploration of information through modern media including graphic forms, video and web based application. This blog contains news from the group and about multimedia information and technology in the library and information. For more information about MmIT see http://www.cilip.org.uk/about/special-interest-groups/multimedia-information-technology-group.

Enter your email address to follow this blog and receive notifications of new posts by email.

Conference countdown

MmIT ConferenceSeptember 12th, 2016
%d bloggers like this: