Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linked Data & Semantic Web Technology Development of Twitter Applications Part 1. Overview Dr. Myungjin Lee.

Similar presentations


Presentation on theme: "Linked Data & Semantic Web Technology Development of Twitter Applications Part 1. Overview Dr. Myungjin Lee."— Presentation transcript:

1 Linked Data & Semantic Web Technology Development of Twitter Applications Part 1. Overview Dr. Myungjin Lee

2 Linked Data & Semantic Web Technology What is Twitter? An information network – a real-time information network that connects you to the latest stories, ideas, opinions and news about what you find interesting – using small bursts of information called Tweets with 140 characters long – 400 million tweet-per-day (June 6, 2012) Open Source base – built on open source software, from the back-end to the front-end – https://dev.twitter.com/opensource/thanks 2

3 Linked Data & Semantic Web Technology not symmetrical (nonreciprocal relationships) inherent openness cannot edit, just can delete symmetrical “walled garden”, protected information can edit and delete 3 How is Twitter Different from Other Social Tools?

4 Linked Data & Semantic Web Technology Twitter Terms Twitter – the service that can communicate with anyone else Tweets – messages of 140 characters or fewer Follower – someone who opts in to receive your tweets Following – the people whose tweets you opt in to receive @reply – a public message typically sent as a response to a previous Tweet Direct messages (DMs) – a message sent privately to one of your followers Private account – an account whose tweets are not public Trending topics – the most popular terms on Twitter at a moment in time Retweets (RTs) – when users find an interesting tweet and share it with their followers Hashtag – the convention of flagging a word with the hash character #topic to aid with keyword search and the tagging of discussions 4

5 Linked Data & Semantic Web Technology Quiz 1.Why is there a character limit in a tweet? A.Twitter decided that’s long enough for a thought. B.Twitter wanted to save on server space. C.There is a hard-character limit on SMS. 2.True or False: There are two types of accounts on Twitter: one that is open and another that is closed. 3.What is a direct message, or DM? A.A tweet that doesn’t go through Twitter’s server. B.A private tweet that goes only to the person you are sending it to. C.A message that comes from Twitter corporate 5

6 Linked Data & Semantic Web Technology Services for Twitter Applications Twitter for Websites – a suit of products that enables websites to easily integrate Twitter, such as the Like button and the Follow button Search API – for products looking to allow a user to query for Twitter content – finding a set of tweets with specific keywords, finding tweets referencing a specific user, or finding tweets from a particular user REST API – to access some of the core primitives of Twitter including timelines, status updates, and user information – offering programmatic access to the timeline, status, and user objects Streaming API – the real-time sample of the Twitter Firehose – low-latency high volume access to Tweets – to establish a long-lived HTTP connection and maintain that connection 6

7 Linked Data & Semantic Web Technology Differences between Streaming and REST 7 REST API Streaming API

8 Linked Data & Semantic Web Technology Registering Your Application https://dev.twitter.com/apps/new Application Details – Name your application name – Description your application description – Website your application’s publicly accessible home page – Callback URL webpage URL where twitter returns after successfully authenticating 8

9 Linked Data & Semantic Web Technology Registering Your Application 9

10 Linked Data & Semantic Web Technology OAuth Process for Desktop Application 10

11 Linked Data & Semantic Web Technology OAuth Process for Web Application 11

12 Linked Data & Semantic Web Technology HTTP Status Codes CodeTextDescription 200OKSuccess! 304Not ModifiedThere was no new data to return. 400Bad Request The request was invalid. An accompanying error message will explain why. This is the status code will be returned during version 1.0 rate limiting. In API v1.1, a request without authentication is considered invalid and you will get this response. 401UnauthorizedAuthentication credentials were missing or incorrect. 403Forbidden The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits. 404Not Found The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method. 406Not AcceptableReturned by the Search API when an invalid format is specified in the request. 410Gone This resource is gone. Used to indicate that an API endpoint has been turned off. For example: "The Twitter REST API v1 will soon stop functioning. Please migrate to API v1.1." 420Enhance Your CalmReturned by the version 1 Search and Trends APIs when you are being rate limited. 422Unprocessable EntityReturned when an image uploaded to POST account/update_profile_banner is unable to be processed. 429Too Many Requests Returned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for the resource. 500Internal Server ErrorSomething is broken. Please post to the group so the Twitter team can investigate. 502Bad GatewayTwitter is down or being upgraded. 503Service UnavailableThe Twitter servers are up, but overloaded with requests. Try again later. 504Gateway timeoutThe Twitter servers are up, but the request couldn't be serviced due to some failure within our stack. Try again later. 12

13 Linked Data & Semantic Web Technology Error Messages and Codes When the Twitter API returns error messages, it does so in your requested format. 13 {"errors":[{"message":"Sorry, that page does not exist","code":34}]} CodeTextDescription 32Could not authenticate youYour call could not be completed as dialed. 34Sorry, that page does not existCorresponds with an HTTP 404 - the specified resource was not found. 88Rate limit exceededThe request limit for this resource has been reached for the current rate limit window. 89Invalid or expired tokenThe access token used in the request is incorrect or has expired. Used in API v1.1 130Over capacityCorresponds with an HTTP 503 - Twitter is temporarily over capacity. 131Internal errorCorresponds with an HTTP 500 - An unknown internal error occurred. 135Could not authenticate you Corresponds with a HTTP 401 - it means that your oauth_timestamp is either ahead or behind our acceptable range 215Bad authentication data Typically sent with 1.1 responses with HTTP code 400. The method requires authentication but it was not presented or was wholly invalid.

14 Linked Data & Semantic Web Technology Twitter Out of the Box Basic Limits for Twitter Applications – 1,000 total updates per day, on any and all devices – 250 total direct messages per day, on any and all devices – Changes to account email: Four per hour – Following (daily): The technical follow limit is 1,000 per day. – Following (account-based): An account is following 2,000 other users. Whitelisting – to provide developers with an increase from 150 to 20,000 requests per hour – however, no longer grant whitelisting request 14

15 Linked Data & Semantic Web Technology Rate Limiting REST API Rate Limiting – Default rate limit for calls to the REST API Unauthenticated calls are permitted 150 request per hour against the public facing IP of the server or device. OAuth calls are permitted 350 requests per hour against the oauth_token – Invalid OAuth information the API For methods which require authentication, the API will return an error response. For methods which can be requested unauthenticated, the request will count against the unauthenticated rate limit. – API methods to submit data using HTTP POST are not rate limited. Search API Rate Limiting – higher than the REST Rate Limit, sufficient for most application Streaming API – rate limiting and access level that are appropriate for long-lived connections 15

16 Linked Data & Semantic Web Technology Rate Limiting Knowing if you are rate limited – If your application is being rate-limited by the REST API, it will receive HTTP 400 response codes. – If you are rate limited on the Search or Streaming APIs, an HTTP 420 response code will be returned. Blacklisting – If you or your application abuses the rate limits we will blacklist it. 1.If you are using the REST API, make a call to the GET application/rate_limit_status from the account or computer which is blacklisted. 2.Explain why you think your application was blacklisted. 3.Describe in detail how you have fixed the problem that you think caused you to be blacklisted. 16

17 Linked Data & Semantic Web Technology Rate Limiting Checking the rate limit – Response headers the current rate status in the response header – Request your rate limits from the API an API call to /1.1/application/rate_limit_status.xml or /1.1/application/rate_limit_status.json 17 X-RateLimit-Limit: 350 X-RateLimit-Remaining: 350 X-RateLimit-Reset: 1277485629 {"reset_time_in_seconds"=>1277485629, "remaining_hits"=>350, "hourly_limit"=>350, "reset_time"=>"Fri Jun 25 17:07:09 +0000 2010"}

18 Linked Data & Semantic Web Technology Things Every Developer Should Know Tweet IDs are enormous and break javascript – use the id_str field instead of id The API is entirely HTTP-based – basically, require a GET request – a POST request to submit, change, or destroy data – a DELETE request to destroy data The API is a RESTful resource – to support XML, JSON, and the RSS and Atom syndication formats Parameters have certain expectations – two things to keep in mind Parameter values should be converted to UTF-8 and URL encoded. The page parameter begins at 1, not 0. – two special parameters in the Twitter API callback : to wraps response in a callback method of your choice suppress_response_codes : If this parameter is present, all responses will be returned with a 200 OK status code – even errors. 18

19 Linked Data & Semantic Web Technology Clojure – twitter-api twitter-api ColdFusion – MonkehTweet Twitter API MonkehTweet Twitter API.NET – LINQ2Twitter LINQ2Twitter – Spring.NET Social extension for Twitter Spring.NET Social extension for Twitter – TweetSharp TweetSharp Go – twittergo twittergo Java – Twitter4J Twitter4J Javascript / node.js – user-stream user-stream – codebird-js codebird-js Lua/Corona SDK – Twitter Facade Twitter Facade Objective-C – FHSTwitterEngine FHSTwitterEngine Perl – Net::Twitter Net::Twitter PHP – tmhOAuth tmhOAuth – twitteroauth twitteroauth – 140dev Twitter Framework 140dev Twitter Framework – codebird-php codebird-php Python – tweepy tweepy – python-twitter python-twitter Ruby – Twitter Twitter – Twitter Console Twitter Console – TweetStream TweetStream Twitter Libraries 19

20 Linked Data & Semantic Web Technology Exploring the Twitter API 20 https://apigee.com/embed/console/twitter

21 Linked Data & Semantic Web Technology References Christoper Peri, Sams Teach Yourself the Twitter API in 24 Hours, SAMS, June 2011. https://twitter.com/about http://www.theverge.com/2012/6/6/3069424/twitter-400-million-total-daily-tweets https://dev.twitter.com/opensource https://dev.twitter.com/start https://apigee.com/embed/console/twitter 21


Download ppt "Linked Data & Semantic Web Technology Development of Twitter Applications Part 1. Overview Dr. Myungjin Lee."

Similar presentations


Ads by Google