Programming With Twitter API
Posted on June 5th, 2009 by Mujeeb RahmanTwitter is a popular social networking service where users can share their updates. User updates known as tweets which are text based posts up to 140 characters, displayed on the user’s profile page and delivered to other users who have subscribed to them called followers. Twitter has gained significant attention from web savvy social networkers, and lately also being used by businesses for marketing.
Twitter provides API that allows developers integrate twitter functions on their sites. Using the API, developers are now able to build desktop and web based messaging applications. These APIs have allowed for hundreds of exciting applications to be made available that allows friends to keep in constant contact.
The Twitter API currently consists of two discrete APIs, REST and Search APIs. We are not allowed to make unlimited calls in this API. The API is entirely HTTP-based. Methods to retrieve data from the Twitter API require a GET request. Methods that submit, change, or destroy data require a POST. A DELETE request is also accepted for methods that destroy data. API Methods that require a particular HTTP method will return an error if you do not make your request with the correct method. The API presently supports XML, JSON, and the RSS and Atom syndication formats, with some methods only accepting a subset of these formats.
Some of Search API Methods are shown below: search: Returns tweets that match a specified query. URL: http://search.twitter.com/search.format Formats:json,atom Example:http://search.twitter.com/search.atom?q=devo&rpp=15 Here rpp is the records per page Trends: trends:Returns the top ten topics that are currently trending on Twitter. URL: http://search.twitter.com/trends.format Format: json We can fetch current topics,daily topics or weekly topics. Example:http://search.twitter.com/trends/daily.json?date=2009-03-19 Some of REST API Methods shown below: statuses/public_timeline : Returns the 20 most recent statuses from non-protected users who have set a custom user icon URL: http://twitter.com/statuses/public_timeline.format Formats: xml, json, rss, atom. Example: http://twitter.com/statuses/public_timeline.xml statuses/friends_timeline:Returns the 20 most recent statuses posted by the authenticating user and that user's friends. URL: http://twitter.com/statuses/friends_timeline.format Formats: xml, json, rss, atom Example:http://twitter.com/statuses/friends_timeline.xml Status Methods:Returns a single status, specified by the id parameter below. URL:http://twitter.com/statuses/show/id.format Formats: xml, json, rss, atom Example: http://twitter.com/statuses/show/123.xml
