@twitterapi at SocialApp Workshop
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

@twitterapi at SocialApp Workshop

  • 6,444 views
Uploaded on

Presented 24 July 2010 at the Heroku Offices, San Francisco

Presented 24 July 2010 at the Heroku Offices, San Francisco

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
6,444
On Slideshare
4,172
From Embeds
2,272
Number of Embeds
18

Actions

Shares
Downloads
44
Comments
0
Likes
5

Embeds 2,272

http://blog.abrah.am 2,224
http://localhost.twitter.com 21
http://swanton420.appspot.com 7
http://translate.googleusercontent.com 3
http://www.slideshare.net 2
https://shanthuyeinmongnai.appspot.com 2
http://localhost 2
http://stream.abrah.am 1
http://localhost:3000 1
http://www.lookwarmsocks.appspot.com 1
http://123locker.com 1
http://staging-assets.local.twitter.com 1
http://www.fakelegendvpn.com 1
http://a0.twimg.com 1
https://twitter.com 1
https://staging93.smf1.twitter.com 1
http://redo.me.uk 1
http://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. TM Saturday, July 24, 2010
  • 2. @twitterapi #appworkshop @themattharris @heroku @heroku TM July 24, 2010 Saturday, July 24, 2010
  • 3. About us TM Saturday, July 24, 2010
  • 4. The team TM Saturday, July 24, 2010
  • 5. @themattharris About me TM Saturday, July 24, 2010
  • 6. What is ? The Twitter Platform TM Saturday, July 24, 2010
  • 7. What is ? ‣ REST API ‣ provides the “basic” Twitter functionality - tweet, follow, etc. ‣ all functions available on your timeline on twitter.com ‣ Search API ‣ real-time search index ‣ get “top tweets” / relevant search results ‣ Streaming API ‣ HTTP long-poll connection ‣ tweets come out of the system in real-time TM Saturday, July 24, 2010
  • 8. Limits ‣ 350 API calls/hour using OAuth against api.twitter.com ‣ Unauthenticated it goes against the source IP address ‣ Authenticated it goes against the calling user ‣ “Natural” limits on ‣ number of tweets sent ‣ number of DMs sent ‣ number of followings / unfollowings ‣ Status limits ‣ No duplicate tweets ‣ No malware links in tweets TM Saturday, July 24, 2010
  • 9. dev.twitter.com The developer portal TM Saturday, July 24, 2010
  • 10. Creating an app Your own small playground TM Saturday, July 24, 2010
  • 11. TM Saturday, July 24, 2010
  • 12. TM Saturday, July 24, 2010
  • 13. TM Saturday, July 24, 2010
  • 14. Browsing docs TM Saturday, July 24, 2010
  • 15. TM Saturday, July 24, 2010
  • 16. TM Saturday, July 24, 2010
  • 17. TM Saturday, July 24, 2010
  • 18. OAuthpocalypse The day is 30th June 16th August 2010 TM Saturday, July 24, 2010
  • 19. What you need to know ‣ All applications must be using OAuth for the REST API ‣ Streaming API will still support Basic Auth ‣ Search API has no auth ‣ Replace curl with twurl for debugging http://dev.twitter.com/pages/auth_overview http://github.com/marcel/twurl TM Saturday, July 24, 2010
  • 20. OAuth Methods ‣ Web must use three legged OAuth ‣ Desktop and mobile apps can also use out-of-band OAuth ‣ Some desktop and mobile apps will be considered for xAuth TM Saturday, July 24, 2010
  • 21. xAuth not XAuth xAuth is OAuth http://dev.twitter.com/pages/xauth TM Saturday, July 24, 2010
  • 22. Check your host! api.twitter.com twitter.com TM Saturday, July 24, 2010
  • 23. Libraries ActionScript/Flash Objective-C/Cocoa & iPhone Programming C/C++ Perl C#/.NET PHP Clojure Python Erlang Qt Java Ruby JavaScript Scala http://dev.twitter.com/pages/oauth_libraries TM Saturday, July 24, 2010
  • 24. twurl ‣ http://github.com/marcel/twurl ‣ Command line tool to interact with using OAuth ‣ Transparently handles OAuth signing against ‣ POST and GET data ‣ Trace requests TM Saturday, July 24, 2010
  • 25. Timelines TM Saturday, July 24, 2010
  • 26. Timeline Endpoints ‣ /1/statuses/public_timeline ‣ /1/statuses/home_timeline ‣ /1/statuses/friends_timeline ‣ /1/statuses/user_timeline ‣ /1/statuses/mentions ‣ /1/statuses/retweeted_by_me ‣ /1/statuses/retweeted_to_me ‣ /1/statuses/retweets_of_me TM Saturday, July 24, 2010
  • 27. Modifiers ‣ include_rts Accepted values: true, 1, t TM Saturday, July 24, 2010
  • 28. Modifiers ‣ include_rts ‣ include_entities Accepted values: true, 1, t TM Saturday, July 24, 2010
  • 29. Modifiers ‣ include_rts ‣ include_entities ‣ trim_user Accepted values: true, 1, t TM Saturday, July 24, 2010
  • 30. Geo TM Saturday, July 24, 2010
  • 31. Endpoints ‣ /1/geo/search ‣ /1/geo/similar_places ‣ /1/geo/reverse_geocode ‣ /1/geo/id/:id ‣ /1/geo/place TM Saturday, July 24, 2010
  • 32. Create a place ‣ /1/geo/search ‣ show what’s nearby ‣ /1/geo/similar_places ‣ not found in search, find by name ‣ /1/geo/place ‣ still not found, create a new place http://api.twitter.com/1/geo/place TM Saturday, July 24, 2010
  • 33. Get location (if allowed) TM Saturday, July 24, 2010
  • 34. Get location (if allowed) TM Saturday, July 24, 2010
  • 35. /1/geo/search - suggest nearby TM Saturday, July 24, 2010
  • 36. /1/geo/search - suggest nearby TM Saturday, July 24, 2010
  • 37. /1/geo/similar_places - find by name TM Saturday, July 24, 2010
  • 38. /1/geo/similar_places - find by name TM Saturday, July 24, 2010
  • 39. /1/geo/place - not it? create it TM Saturday, July 24, 2010
  • 40. Technical Info ... ‣ /1/geo/similar_places ‣ must run this first to get a creation_token TM Saturday, July 24, 2010
  • 41. Technical Info ...                ],                "full_name":  "Twitter  HQ,  San  Francisco",                "place_type":  "poi"            }        ],        "token":  "36179c9bf78835898ebf521c1defd4be"    },    "query":  {        "url":  "http://api.twitter.com/1/geo/similar_places.json? query=&contained_within=&lat=37.7821120598956&accuracy=&autocompl ete=&long=-­‐122.400612831116&granularity=&name=Twitter",        "type":  "similar_places", TM Saturday, July 24, 2010
  • 42. More Info... Check out bit.ly/twitter-api-geo TM Saturday, July 24, 2010
  • 43. @anywhere TM Saturday, July 24, 2010
  • 44. Core Features ‣ Hovercards ‣ Tweet Box ‣ Follow Buttons ‣ Linkify ‣ Connect with Twitter TM Saturday, July 24, 2010
  • 45. Easiest Example <head> <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&amp;v=1"> </script> <script type="text/javascript"> twttr.anywhere(function(T) { T.hovercards(); T("#follow-placeholder").followButton('themattharris'); T("#tbox").tweetBox(); }); </script> </head> TM Saturday, July 24, 2010
  • 46. Easiest Example <head> <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&amp;v=1"> </script> <script type="text/javascript"> twttr.anywhere(function(T) { T.hovercards(); T("#follow-placeholder").followButton('themattharris'); T("#tbox").tweetBox(); }); </script> </head> TM Saturday, July 24, 2010
  • 47. Easiest Example <head> <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&amp;v=1"> </script> <script type="text/javascript"> twttr.anywhere(function(T) { T.hovercards(); T("#follow-placeholder").followButton('themattharris'); T("#tbox").tweetBox(); }); </script> </head> TM Saturday, July 24, 2010
  • 48. Easiest Example <head> <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&amp;v=1"> </script> <script type="text/javascript"> twttr.anywhere(function(T) { T.hovercards(); T("#follow-placeholder").followButton('themattharris'); T("#tbox").tweetBox(); }); </script> </head> TM Saturday, July 24, 2010
  • 49. Easiest Example <head> <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&amp;v=1"> </script> <script type="text/javascript"> twttr.anywhere(function(T) { T.hovercards(); T("#follow-placeholder").followButton('themattharris'); T("#tbox").tweetBox(); }); </script> </head> TM Saturday, July 24, 2010
  • 50. More Info... Check out bit.ly/anywhere-begin TM Saturday, July 24, 2010
  • 51. Bridge Code @anywhere to api.twitter.com TM Saturday, July 24, 2010
  • 52. Overview ‣ Use connect with Twitter ‣ Hook into authComplete ‣ Send the bridge code to your server ‣ Exchange the bridge code using /oauth/access_token ‣ Verify TM Saturday, July 24, 2010
  • 53. Use connect with Twitter T("#connect-placeholder").connectButton({ authComplete: function(user, bridge_code) { $.post('/mypage.php', { 'bridge_code' : bridge_code }); } }); TM Saturday, July 24, 2010
  • 54. Hook into authComplete T("#connect-placeholder").connectButton({ authComplete: function(user, bridge_code) { $.post('/mypage.php', { 'bridge_code' : bridge_code }); } }); TM Saturday, July 24, 2010
  • 55. Hook into authComplete T("#connect-placeholder").connectButton({ authComplete: function(user, bridge_code) { $.post('/mypage.php', { 'bridge_code' : bridge_code }); } }); TM Saturday, July 24, 2010
  • 56. Send to your server T("#connect-placeholder").connectButton({ authComplete: function(user, bridge_code) { $.post('/mypage.php', { 'bridge_code' : bridge_code }); } }); TM Saturday, July 24, 2010
  • 57. Exchange the bridge code ‣ POST to https://api.twitter.com/oauth/access_token ‣ Parameter is oauth_bridge_code ‣ Sign with your applications consumer token and secret TM Saturday, July 24, 2010
  • 58. Exchange the token - PHP $http->request( 'POST', 'https://api.twitter.com/oauth/access_token', array( 'oauth_bridge_code' => $_REQUEST['bridge_code'] ) ); TM Saturday, July 24, 2010
  • 59. Verify ‣ Using the user tokens call /1/account/verify_credentials.json ‣ Generate the signature sha1( user_id + consumer_secret ) ‣ Compare the signature with the cookie value in twitter_anywhere_identity TM Saturday, July 24, 2010
  • 60. Streaming API Near-Realtime Access to Public Statuses TM Saturday, July 24, 2010
  • 61. Streaming API ‣ A persistent connection to Twitter servers ‣ Get pushed a tweet that matches your predicate in “real-time” ‣ Server to server integrations TM Saturday, July 24, 2010
  • 62. Basic Usage ‣ Curl with Basic Auth or Twurl with OAuth ‣ One connection per username permitted http://stream.twitter.com/1/statuses/sample.json TM Saturday, July 24, 2010
  • 63. Follow some users ‣ Curl with Basic Auth or Twurl with OAuth ‣ One connection per username permitted ‣ Pass up to 400 user_ids, comma seperated http://stream.twitter.com/1/statuses/filter.json TM Saturday, July 24, 2010
  • 64. Filter by keyword ‣ Curl with Basic Auth or Twurl with OAuth ‣ One connection per username permitted ‣ Pass up to 200 keywords, comma seperated ‣ Example: Twitter will return statuses which contain: TWITTER, twitter, "Twitter", twitter., #twitter and @twitter http://stream.twitter.com/1/statuses/filter.json TM Saturday, July 24, 2010
  • 65. Streaming API - Default Level ‣ 200 x Keywords ‣ 400 x Follow userids ‣ 10 x 1-degree location boxes TM Saturday, July 24, 2010
  • 66. More Info... Check out bit.ly/streaming_api TM Saturday, July 24, 2010
  • 67. Stay Informed... Join bit.ly/twitter-anywhere-talk bit.ly/twitter-dev-talk Important Stuff @twitterapi status.twitter.com bit.ly/twitter-api-announce TM Saturday, July 24, 2010
  • 68. Help... Check out dev.twitter.com TM Saturday, July 24, 2010
  • 69. Questions? Follow us at twitter.com/twitterapi twitter.com/themattharris TM Saturday, July 24, 2010
  • 70. TM Saturday, July 24, 2010