Skip to content

Twitter APIs: Getting started with the RESTful interface

March 30, 2011

I’m writing an ongoing series of posts on Mobile, Social, and Local technologies, collectively “MoSoLo“.  Previously I’ve covered the rise of web APIs, Facebook (history and openess, social plugins, Open Graph, and the Graph API), web API power tools for programming bliss including YQL for PayPal transactions, data markets, REST+JSON, and more.

In this post I’m going to start exploring the power of 140 little characters at a time:  Twitter and its APIs.  I’m going to assume you’re familiar with the basic Twitter service and the company behind it; if not, please read through the Twitter Wikipedia page and “A Brief History of Twitter” for background.

By the way if you’re curious as to why Twitter messages (“tweets”) are limited to 140 characters, read “How Twitter Was Born” for the details.  The short answer: wireless texting (SMS) limitations, as the service was heavily SMS-oriented in its early days.

Though Twitter has done some things of late that have the developer community and its partners up in arms, it nonetheless has one of the most used RESTful APIs on the web.  You can learn from Twitter’s API even if you don’t want to go down the path of partnering with them.

Twitter’s API is explained on their API Documentation page.  It includes sections on authenticating using OAuth, a slideshow introducing the Twitter API (@twitterapi), a description of the main Twitter REST API used to access core data including timelines and user information,  Twitter Streaming API documentation (this API is used to access near realtime subsets of public Twitter status updates), and information on the RESTful search API that came to Twitter via their acquisition of Summize.

Note that Twitter has chosen the one true web path:  REST + JSON +OAuth.  This is a very good thing for developers as it helps to make the API simple and easy to use.  For instance, to request the 20 most recent status updates (tweets) from the currently authenticated user, you would make the following HTTP GET request:

where format specifies which format you’d like to receive results back in (options include json, xml, rss, or atom) and version specifies the API version for the call.  Click here to load this call with JSON response into Twitter’s “Twurl” API console, then click “Send” to see the results for your own authenticated account (you will need a Twitter account for this to work).

Click here to read the full post on the PayPal X Developer Network including another example of the Twitter REST API’s usage.


From → Uncategorized

  1. Love it. Great post Bill. I am book marking it.

  2. Thanks, glad it’s useful for you!

Comments are closed.

%d bloggers like this: