2. About Me My Name is Joel Strellner I go by @jstrellner on Twitter I’ve been developing things using the Twitter API’s since March, 2008. Twitturly ( http://twitturly.com ) inView ( http://myinview.com )
3. What is an API? An API is a way for any service to allow any other service to programmatically access and interact with that services data.
4. What API’s does Twitter offer? Twitter currently offers 3 API’s: REST API REST Search API (previously Summize) Streaming API Depreciated API’s Data Mining Feed XMPP Feed
5. REST API The REST API is the primary API. Used for: Authentication OAuth Basic Auth (depreciated, use OAuth) Posting Tweets Getting your timeline (Tweets from those you follow) Getting your Mentions
6. Search API Supports all of the same advanced search options that you can do on search.twitter.com Get trending topics by day, week or current Allows you to consume it in atom and json formats Supports fuzzy geolocation filtering Uses *different* user ID’s than the REST API Will be eventually the same (V2 of the API’s)
7. Streaming API Methods for the Public Stream: Firehose (Not available to most) Gardenhose (large portion of Firehose) Spritzer (small portion of the Firehose) Following Specific Users/Terms Birddog / Shadow / Follow must start with @user or have “in_reply_to” for that user Allows you to follow 200k, 50k or 200 users, respectively Track Allows you to get any tweet matching a keyword Does not support phrases
8. What’s being built? Seesmic Desktop ( http://seesmic.com/ ) Uses the REST API Uses the Search API Twitalizer ( http://twitalyzer.com ) Uses the Search API (might use the REST API too) inView ( http://myinview.com ) Uses the streaming API Your App?
12. How to send a tweet (Basic Auth) PHP: <?php $msg = ‘this is an example tweet.’; $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, "http:twitter.com/statuses/update.json"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=" . urlencode($msg)); curl_setopt($curl_handle, CURLOPT_USERPWD, "$twitter_username:$twitter_password"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); ?> $buffer now has your response.
13. Q&A Any questions, or comments? Feel free to tweet your question using the #tmeetuphashtag.
14. Resources Twitter API Documentation http://apiwiki.twitter.com/Twitter-API-Documentation Twitter Streaming API Documentation http://apiwiki.twitter.com/Streaming-API-Documentation Ask any API Question http://groups.google.com/group/twitter-development-talk
Editor's Notes
All of these API’s are available, whether you are developing for the desktop or the web. The Streaming API’s are best suited for web development.
Mention that this requires polling Twitter. Also that there are rate limiting methods in place, so you cannot constantly poll for updates.OAuth has two forms currently: a PIN based system, used for mobile apps and Desktop apps, and a standard Twitter login method, used for web based applications.
Pull API, you request if from them as you need it.
Explain that the streaming API requires a constant connection to Twitter, but you get real-time data. No need to pull.