SlideShare a Scribd company logo
Linked Data &
  Semantic Web
  Technology




Development of Twitter Applications
                  Part 1. Overview


                    Dr. Myungjin Lee
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
Linked Data & Semantic Web Technology
How is Twitter Different from Other Social Tools?




      • not symmetrical                 • symmetrical
        (nonreciprocal relationships)
      • inherent openness               • “walled garden”, protected
                                          information
      • cannot edit, just can delete    • can edit and delete



                                                                       3
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
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
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
Linked Data & Semantic Web Technology
Differences between Streaming and REST
  REST API




                                          Streaming API




                                                          7
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
Linked Data & Semantic Web Technology
Registering Your Application




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




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




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


                                                                                                                                                                   12
Linked Data & Semantic Web Technology
Error Messages and Codes
      • When the Twitter API returns error messages, it does so in your
        requested format.
                {"errors":[{"message":"Sorry, that page does not exist","code":34}]}



       Code                             Text                                                        Description

         32         Could not authenticate you        Your call could not be completed as dialed.

         34         Sorry, that page does not exist   Corresponds with an HTTP 404 - the specified resource was not found.

         88         Rate limit exceeded               The request limit for this resource has been reached for the current rate limit window.

         89         Invalid or expired token          The access token used in the request is incorrect or has expired. Used in API v1.1

        130         Over capacity                     Corresponds with an HTTP 503 - Twitter is temporarily over capacity.

        131         Internal error                    Corresponds with an HTTP 500 - An unknown internal error occurred.

                                                      Corresponds with a HTTP 401 - it means that your oauth_timestamp is either ahead or behind our
        135         Could not authenticate you
                                                      acceptable range

                                                      Typically sent with 1.1 responses with HTTP code 400. The method requires authentication but it
        215         Bad authentication data
                                                      was not presented or was wholly invalid.



                                                                                                                                                        13
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
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
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
Linked Data & Semantic Web Technology
Rate Limiting
      • Checking the rate limit
                – Response headers
                          • the current rate status in the response header

                                  X-RateLimit-Limit: 350
                                  X-RateLimit-Remaining: 350
                                  X-RateLimit-Reset: 1277485629




                – 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

                                  {"reset_time_in_seconds"=>1277485629,
                                   "remaining_hits"=>350,
                                   "hourly_limit"=>350,
                                   "reset_time"=>"Fri Jun 25 17:07:09 +0000 2010"}




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




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




                                               20
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
Linked Data & Semantic Web Technology

More Related Content

PPTX
Development of Twitter Application #8 - Streaming API
PPTX
Twitter API, Streaming and SharePoint 2013
PDF
20130504 - FeWeb - Twitter API
PPTX
Detection of Phishing Websites
PPSX
Scratching Your Brain into Dark Web by Arpit Maheshwari
PDF
Protecting Your APIs Against Attack & Hijack
PDF
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
PPTX
Web technologies lesson 1
Development of Twitter Application #8 - Streaming API
Twitter API, Streaming and SharePoint 2013
20130504 - FeWeb - Twitter API
Detection of Phishing Websites
Scratching Your Brain into Dark Web by Arpit Maheshwari
Protecting Your APIs Against Attack & Hijack
Vorontsov, golovko ssrf attacks and sockets. smorgasbord of vulnerabilities
Web technologies lesson 1

Viewers also liked (13)

PPTX
Development of Twitter Application #5 - Users
PPTX
Digital Photo Workshop
PPTX
Twitter applications
PPTX
Twitter and Medical Education: Information and Inspiration
PPTX
Lambda Architecture - Storm, Trident, SummingBird ... - Architecture and Over...
PDF
PPTX
Data Flow Diagram and Sequence Diagram
PPT
KERNAL ARCHITECTURE
PPTX
Diagrams
PPTX
What is Kernel, basic idea of kernel
PDF
Sequence diagram- UML diagram
PPT
Entity relationship diagram (erd)
PPTX
Slideshare ppt
Development of Twitter Application #5 - Users
Digital Photo Workshop
Twitter applications
Twitter and Medical Education: Information and Inspiration
Lambda Architecture - Storm, Trident, SummingBird ... - Architecture and Over...
Data Flow Diagram and Sequence Diagram
KERNAL ARCHITECTURE
Diagrams
What is Kernel, basic idea of kernel
Sequence diagram- UML diagram
Entity relationship diagram (erd)
Slideshare ppt
Ad

Similar to Development of Twitter Application #1 - Overview (20)

PPTX
Mz twitter-1.1-sdl
PPTX
Twitter api
PPTX
OAuth
PPTX
Spring Social - Messaging Friends & Influencing People
PDF
CSE5656 Complex Networks - Gathering Data from Twitter
PPTX
Appsworld - Mobilize your SharePoint with WinWire
PPTX
Data Collection from Social Media Platforms
PPTX
PPT
Oauth2.0
PPTX
Social Media Data Collection & Analysis
PPTX
Harvesting Data from Twitter Workshop: Hands-on Experience
PDF
Leverage Social Media Data with SAP Data Services
PPTX
Beyond Social – Tailor SharePoint 2013 Social features according to your need...
PDF
oauth-for-credentials-security-in-rest-api-access
PDF
Creating a RESTful api without losing too much sleep
PDF
Building A Great API - Evan Cooke, Cloudstock, December 2010
PPTX
DotNet 2019 | Hugo Biarge - Autenticación en aplicaciones web y nativas
PPTX
Reaching 1 Million APIs and what to do when we get there
PDF
PPTX
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
Mz twitter-1.1-sdl
Twitter api
OAuth
Spring Social - Messaging Friends & Influencing People
CSE5656 Complex Networks - Gathering Data from Twitter
Appsworld - Mobilize your SharePoint with WinWire
Data Collection from Social Media Platforms
Oauth2.0
Social Media Data Collection & Analysis
Harvesting Data from Twitter Workshop: Hands-on Experience
Leverage Social Media Data with SAP Data Services
Beyond Social – Tailor SharePoint 2013 Social features according to your need...
oauth-for-credentials-security-in-rest-api-access
Creating a RESTful api without losing too much sleep
Building A Great API - Evan Cooke, Cloudstock, December 2010
DotNet 2019 | Hugo Biarge - Autenticación en aplicaciones web y nativas
Reaching 1 Million APIs and what to do when we get there
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
Ad

More from Myungjin Lee (20)

PDF
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
PDF
JSP 프로그래밍 #05 HTML과 JSP
PDF
JSP 프로그래밍 #04 JSP 의 기본
PDF
JSP 프로그래밍 #03 서블릿
PDF
JSP 프로그래밍 #02 서블릿과 JSP 시작하기
PDF
JSP 프로그래밍 #01 웹 프로그래밍
PDF
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
PDF
오픈 데이터와 인공지능
PDF
법령 온톨로지의 구축 및 검색
PDF
도서관과 Linked Data
PDF
공공데이터, 현재 우리는?
PDF
LODAC 2017 Linked Open Data Workshop
PDF
Introduction of Deep Learning
PDF
쉽게 이해하는 LOD
PDF
서울시 열린데이터 광장 문화관광 분야 LOD 서비스
PDF
LOD(Linked Open Data) Recommendations
PDF
Interlinking for Linked Data
PDF
Linked Open Data Tutorial
PPTX
Linked Data Usecases
PDF
공공데이터와 Linked open data
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
JSP 프로그래밍 #05 HTML과 JSP
JSP 프로그래밍 #04 JSP 의 기본
JSP 프로그래밍 #03 서블릿
JSP 프로그래밍 #02 서블릿과 JSP 시작하기
JSP 프로그래밍 #01 웹 프로그래밍
관광 지식베이스와 스마트 관광 서비스 (Knowledge base and Smart Tourism)
오픈 데이터와 인공지능
법령 온톨로지의 구축 및 검색
도서관과 Linked Data
공공데이터, 현재 우리는?
LODAC 2017 Linked Open Data Workshop
Introduction of Deep Learning
쉽게 이해하는 LOD
서울시 열린데이터 광장 문화관광 분야 LOD 서비스
LOD(Linked Open Data) Recommendations
Interlinking for Linked Data
Linked Open Data Tutorial
Linked Data Usecases
공공데이터와 Linked open data

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Spectroscopy.pptx food analysis technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation theory and applications.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectroscopy.pptx food analysis technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation theory and applications.pdf
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Digital-Transformation-Roadmap-for-Companies.pptx

Development of Twitter Application #1 - Overview

  • 1. Linked Data & Semantic Web Technology Development of Twitter Applications Part 1. Overview Dr. Myungjin Lee
  • 2. 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 Linked Data & Semantic Web Technology
  • 3. How is Twitter Different from Other Social Tools? • not symmetrical • symmetrical (nonreciprocal relationships) • inherent openness • “walled garden”, protected information • cannot edit, just can delete • can edit and delete 3 Linked Data & Semantic Web Technology
  • 4. 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 Linked Data & Semantic Web Technology
  • 5. 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 Linked Data & Semantic Web Technology
  • 6. 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 Linked Data & Semantic Web Technology
  • 7. Differences between Streaming and REST REST API Streaming API 7 Linked Data & Semantic Web Technology
  • 8. 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 Linked Data & Semantic Web Technology
  • 9. Registering Your Application 9 Linked Data & Semantic Web Technology
  • 10. OAuth Process for Desktop Application 10 Linked Data & Semantic Web Technology
  • 11. OAuth Process for Web Application 11 Linked Data & Semantic Web Technology
  • 12. HTTP Status Codes Code Text Description 200 OK Success! 304 Not Modified There was no new data to return. The request was invalid. An accompanying error message will explain why. This is the status code will be returned 400 Bad Request during version 1.0 rate limiting. In API v1.1, a request without authentication is considered invalid and you will get this response. 401 Unauthorized Authentication credentials were missing or incorrect. The request is understood, but it has been refused or access is not allowed. An accompanying error message will 403 Forbidden explain why. This code is used when requests are being denied due to update limits. The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the 404 Not Found requested format is not supported by the requested method. 406 Not Acceptable Returned by the Search API when an invalid format is specified in the request. This resource is gone. Used to indicate that an API endpoint has been turned off. For example: "The Twitter REST 410 Gone API v1 will soon stop functioning. Please migrate to API v1.1." 420 Enhance Your Calm Returned by the version 1 Search and Trends APIs when you are being rate limited. 422 Unprocessable Entity Returned when an image uploaded to POST account/update_profile_banner is unable to be processed. Returned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for 429 Too Many Requests the resource. 500 Internal Server Error Something is broken. Please post to the group so the Twitter team can investigate. 502 Bad Gateway Twitter is down or being upgraded. 503 Service Unavailable The Twitter servers are up, but overloaded with requests. Try again later. 504 Gateway timeout The Twitter servers are up, but the request couldn't be serviced due to some failure within our stack. Try again later. 12 Linked Data & Semantic Web Technology
  • 13. Error Messages and Codes • When the Twitter API returns error messages, it does so in your requested format. {"errors":[{"message":"Sorry, that page does not exist","code":34}]} Code Text Description 32 Could not authenticate you Your call could not be completed as dialed. 34 Sorry, that page does not exist Corresponds with an HTTP 404 - the specified resource was not found. 88 Rate limit exceeded The request limit for this resource has been reached for the current rate limit window. 89 Invalid or expired token The access token used in the request is incorrect or has expired. Used in API v1.1 130 Over capacity Corresponds with an HTTP 503 - Twitter is temporarily over capacity. 131 Internal error Corresponds with an HTTP 500 - An unknown internal error occurred. Corresponds with a HTTP 401 - it means that your oauth_timestamp is either ahead or behind our 135 Could not authenticate you acceptable range Typically sent with 1.1 responses with HTTP code 400. The method requires authentication but it 215 Bad authentication data was not presented or was wholly invalid. 13 Linked Data & Semantic Web Technology
  • 14. 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 Linked Data & Semantic Web Technology
  • 15. 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 Linked Data & Semantic Web Technology
  • 16. 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 Linked Data & Semantic Web Technology
  • 17. Rate Limiting • Checking the rate limit – Response headers • the current rate status in the response header X-RateLimit-Limit: 350 X-RateLimit-Remaining: 350 X-RateLimit-Reset: 1277485629 – 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 {"reset_time_in_seconds"=>1277485629, "remaining_hits"=>350, "hourly_limit"=>350, "reset_time"=>"Fri Jun 25 17:07:09 +0000 2010"} 17 Linked Data & Semantic Web Technology
  • 18. 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 Linked Data & Semantic Web Technology
  • 19. Twitter Libraries • Clojure • Objective-C – twitter-api – FHSTwitterEngine • ColdFusion • Perl – MonkehTweet Twitter API – Net::Twitter • .NET • PHP – LINQ2Twitter – tmhOAuth – Spring.NET Social extension for Twitter – twitteroauth – TweetSharp – 140dev Twitter Framework • Go – codebird-php – twittergo • Python • Java – tweepy – Twitter4J – python-twitter • Javascript / node.js • Ruby – user-stream – Twitter – codebird-js – Twitter Console • Lua/Corona SDK – TweetStream – Twitter Facade 19 Linked Data & Semantic Web Technology
  • 20. Exploring the Twitter API https://apigee.com/embed/console/twitter 20 Linked Data & Semantic Web Technology
  • 21. 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 Linked Data & Semantic Web Technology