Developing for @twitterapi (Techcrunch Disrupt Hackathon)

  • 54,457 views
Uploaded on

 

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

Views

Total Views
54,457
On Slideshare
0
From Embeds
0
Number of Embeds
7

Actions

Shares
Downloads
0
Comments
3
Likes
25

Embeds 0

No embeds

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. Techcrunch hackathon!
  • 2. At the Techcr unch DisruptHa ckathon - giving a talk about@twitte rapi & watching people hack!21 May via Twitter for iPhone from Pier 94 755 12th Avenue New York, NY View Tweets at this place
  • 3. >660K Developers on @twitterAPI
  • 4. >900K applications +The Officially Owned and Operated ones
  • 5. The opportunityAnalyticsContent Interpreting user information (for Filtering valuable data data signals Creating rich(real-time) to convey Surfacingreal-time experiences (for the Helping users publish the right content into actionable information for relevant, meaningful conversations ecosystem) in exchange for greater to enterprise users) to facilitate target at the right time to optimize resonance.Curation industries audiences.or interests. reach and growth. engagement and manage reputation.PublishingEnterprise
  • 6. Every tweet that comes from quora totwitter results in 30 clicks per tweet.⇢ Charlie Cheever, Co-Founder
  • 7. Flipboard sees 50-80% lift in retentionfrom users who have signed intoTwitter versus those who have not.
  • 8. Twitter is just three things:Tweets,relationships between those threeAnd the users, anD Timelines
  • 9. What is the @TwitterAPI?REST API⇢provides Twitter functionality⇢read / write / read DM (Tweet, Follow, DM, etc.)Search API⇢real-time search indexStreaming API⇢HTTP long poll connection⇢Tweets in real-time
  • 10. Using the system 13B API calls 150,000 calls per day ≈ per second
  • 11. Three main objectsStatus Objects → the Tweet (text, author, and metadata)User objects → username, screen name, avatarTimelines → orderings of Tweets
  • 12. The tweets unique ID. These Text of the tweet. IDs are roughly sorted & Consecutive duplicate tweets developers should treat them are rejected. 140 character as opaque (http://bit.ly/dCkppc). max (http://bit.ly/4ud3he). DEPRECATED {"id"=>12296272736, "text"=> "An early look at Annotations: http://groups.google.com/group/twitter-api-announce/browse_thread/thread/fa5da2608865453", Tweets "created_at"=>"Fri Apr 16 17:55:46 +0000 2010", creation "in_reply_to_user_id"=>nil, The ID of an existing tweet that date. "in_reply_to_screen_name"=>nil, this tweet is in reply to. Wont "in_reply_to_status_id"=>nil be set unless the author of theThe authors The screen name & "favorited"=>false, user ID. user ID of replied to referenced tweet is mentioned. "truncated"=>false, Truncated to 140 characters. Only tweet author. "user"=> possible from SMS. The authors {"id"=>6253282, user name. The authors "screen_name"=>"twitterapi", The authors biography. "name"=>"Twitter API", screen name.bedded object can get out of sync. "description"=> "The Real Twitter API. I tweet about API changes, service issues and The author of the tweet. This happily answer questions about Twitter and our API. Dont get an answer? Its on my website.", "url"=>"http://apiwiki.twitter.com", The authors "location"=>"San Francisco, CA", URL. The authors "location". This is a free-form text field, and "profile_background_color"=>"c1dfee", there are no guarantees on whether it can be geocoded. "profile_background_image_url"=> "http://a3.twimg.com/profile_background_images/59931895/twitterapi-background-new.png", Rendering information "profile_background_tile"=>false, for the author. Colors "profile_image_url"=>"http://a3.twimg.com/profile_images/689684365/api_normal.png", are encoded in hex "profile_link_color"=>"0000ff", values (RGB). "profile_sidebar_border_color"=>"87bc44", The creation date
  • 13. Timelinesuser → a the Tweets a given user has authoredhome → the main timeline you would see in a clientMentions → all the Tweets that @mention a user
  • 14. Causing changeTweeting → a POST to status/updateFollowing → a POST to friendships/createDM-ing → a POST to direct_messages/new
  • 15. AuthenticationOAuth 1.0a⇢ signature based requests⇢ user driven access to the API⇢ client differentiated access to the APIApplications don’t have passwords⇢ applications store tokens for their users⇢ users can change passwords, but tokens still workOAuth 2.0⇢ coming soon!
  • 16. Limits350 OAuth calls / user / hour / IP⇢ authenticated calls goes against calling user⇢ unauthenticated calls goes against calling IP“Natural” limits⇢ limits on number of Tweets / DMs sent⇢ limits on number of follows / unfollows a dayStatus Limits⇢ can’t send “duplicate” tweets
  • 17. Streaming APIPersistent connections⇢get pushed a tweet, in real-time, that matches your predicate⇢“push” version of search⇢read-onlyUser streams / Site streams⇢re-create the client experience using streams⇢great for “client” experiences
  • 18. Latency200ms100ms 0ms
  • 19. Streaming API’s Sample hosehttp://stream.twitter.com/1/statuses/sample.jsonuse curl⇢uses basic authentication⇢one connection per username
  • 20. Streaming API’s Track and followhttp://stream.twitter.com/1/statuses/filter.jsonTrack⇢watch a particular keyword⇢up to 200 can be sent as CSV with track parameterFollow⇢get all the tweets (RTs, etc.) from a particular user⇢up to 400 can be issued as CSV with follow parameter
  • 21. Search APIReal-time search index⇢Tweets indexed in <10 seconds⇢1.5 billion requests a daySearch Corpus⇢index goes back 7-10 days depending on traffic⇢contains the best quality Tweets
  • 22. Querying the Search APIhttp://search.twitter.com/search.atom?q= !Use Curl⇢ unauthenticated⇢ rate-limited by IP addressParameters⇢ just put your query in the q parameter⇢ use from to restrict to a particular username⇢ OR to combine queries (q=techcrunch+OR+disrupt)⇢ - to negate (q=techcrunch+-from=%3Araffi)
  • 23. Tools of the Tradedev.twitter.com⇢ documentation central⇢ create and register new applicationstwurl⇢ OAuth enabled version of curl⇢ allows you to manually test authenticated and unauthenticated RESTTwitter for Mac⇢ built in “developer console”
  • 24. Tweet buttonImplementing⇢simple JavaScript to drop onto your site⇢allows you to share URLs, and to recommend people to followBack-end⇢high speed URL counting API
  • 25. Follow me atQuestions? twitter.com/raffi