Using the Twitter API

Post on 19-May-2015

858 views 1 download

description

Presented at the 2009 Charles River Rails Conference.

Transcript of Using the Twitter API

Using the Twitter API

(in 140 slides or less)

Jeremy Weiskotten @doctorzaius

Two APIs?!

• Search• and the REST

Rate Limits• REST

100 reqs / hour / IPHTTP 4xx if exceeded

• Search>100 reqs / hour / IPHTTP 503 if exceeded

• Whitelisting for the super special

• Blacklisting for the douchebag community

Rate Limits?

Constraints are for embracing!

• Cache• Cheat• Be Creative

I’ve got a bad feeling about this…

Authentication

• HTTP Basic Auth• OAuth

Would you give this guy your Twitter password?

OAuth

• “An open protocol to allow secure API authorization in a simple and standard method from desktop and web applications.”

• OpenID for APIs

REST API

• Friendships• Blocking• Notifications• Favorites

• Timelines• Statuses• Direct Messages• Users / Friends / Followers• Account

http://apiwiki.twitter.com/Twitter-API-Documentation

Get some REST

• HTTP verbs feat. overloaded POST

• Meaningful response codes

• Common formats– XML– JSON– RSS, Atom

Search

formerly known as Summize

Trends

Search

• By time– since, until

• By user– from, to,

@referencing• By geocode

– lat, lng, radius• By language• Boolean OR• Negation• Paginated results

– up to 100 per page

Once is Enough

• since_id

Apps

• Favrd• TweetStats• Weatherizer• Twitterfall• Twitree• Twitter Analyzer

• Twitshirt• CrowdedInk• Thunder Thimble• …Thousands More

Demo

• John Nunemaker’s Twitter gemhttp://github.com/jnunemaker/twitter

See also… Twitter4R

http://twitter4r.rubyforge.org/ Dan Croak’s twitter-search

http://github.com/dancroak/twitter-search