Top Banner
Using the Twitter API (in 140 slides or less) Jeremy Weiskotten @doctorzaius
21

Using the Twitter API

May 19, 2015

Download

Technology

jeremyw

Presented at the 2009 Charles River Rails Conference.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Using the Twitter API

Using the Twitter API

(in 140 slides or less)

Jeremy Weiskotten @doctorzaius

Page 2: Using the Twitter API
Page 3: Using the Twitter API
Page 4: Using the Twitter API
Page 5: Using the Twitter API
Page 6: Using the Twitter API

Two APIs?!

• Search• and the REST

Page 7: Using the Twitter API

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

Page 8: Using the Twitter API

Rate Limits?

Constraints are for embracing!

• Cache• Cheat• Be Creative

I’ve got a bad feeling about this…

Page 9: Using the Twitter API

Authentication

• HTTP Basic Auth• OAuth

Page 10: Using the Twitter API

Would you give this guy your Twitter password?

Page 11: Using the Twitter API

OAuth

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

• OpenID for APIs

Page 12: Using the Twitter API

REST API

• Friendships• Blocking• Notifications• Favorites

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

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

Page 13: Using the Twitter API

Get some REST

• HTTP verbs feat. overloaded POST

• Meaningful response codes

• Common formats– XML– JSON– RSS, Atom

Page 14: Using the Twitter API

Search

formerly known as Summize

Page 15: Using the Twitter API
Page 16: Using the Twitter API
Page 17: Using the Twitter API

Trends

Page 18: Using the Twitter API

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

Page 19: Using the Twitter API

Once is Enough

• since_id

Page 20: Using the Twitter API

Apps

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

• Twitshirt• CrowdedInk• Thunder Thimble• …Thousands More

Page 21: Using the Twitter API

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