SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Twitter API
Keys for creating an awesome application !
Pascal Alberty
@zorrobiwan
CTO Managing Partner
Twitter Dev Ecosystem
● Twitter success
○ Thanks Dev Community !
● API
○ September 2006
○ Very complete
○ Open
○ Free
https://blog.twitter.com/2006/introducing-twitter-api
The APIs
● APIs
○ Search API
○ REST API
○ Streaming API
○ https://dev.twitter.com/docs/history-rest-search-api
● Versions
○ API version 1 (almost deprecated)
○ API version 1.1
Resources
https://dev.twitter.com/
(Drupal )
Authentication
● OAuth
○ Each API request must be authorized
○ Access token on behalf of a Twitter user
● Obtaining access token
○ Sign in with Twitter
○ 3-legged OAuth
○ Pin based OAuth
○ dev.twitter.com
○ ...
https://twitter.com/settings/applications
Declare your application
https://dev.twitter.com/apps/new
Rate limiting
● Rate limit window duration
○ 15 minutes
● Requests allotted
○ per user
○ via application-only auth
● Example
○ GET statuses/user_timeline
○ per user: 150 requests per 15 minutes
○ via app: 300 requests per 15 minutes
https://dev.twitter.com/docs/rate-limiting/1.1/limits
Other technical limits
● Direct messages
○ 250 per day
● Tweets
○ 1,000 per day
○ Retweets are counted as Tweets.
● Changes to account email
○ Four per hour
● Following
○ 1,000 per day
● Following (account-based)
○ up to following 2,000 other users
Platform objects
● Tweets can be found alone, within user objects, but
most often within timelines
● Users can be found tweeting, following, and
favoriting on Twitter
● Entities are most often found within Tweets
● Places can be found throughout the natural universe,
but typically only appear attached to Tweets on Twitter
Objects type
● JSON !
● XML output will be dropped soon
○ Only JSON output with API 1.1
● Be careful with ids (64 bits)
○ use String version (especially if using Javascript)
○ Twitpocalypse
■ https://dev.twitter.com/docs/twitter-ids-json-and-snowflake
○ Idpocalypse
■ https://dev.twitter.com/blog/64-bit-twitter-user-idpocalypse
Tweet Example
https://api.twitter.com/1/statuses/show.json?id=341545927401680897&include_entities=true
User example
https://api.twitter.com/1/users/show.json?screen_name=zorrobiwan&include_entities=true
Entities / Entity Example
● Hashtags, Medias, URLs, User mentions,
Symbols
● No need to parse
● Data used for display also (ex: display_url)
Place example
https://api.twitter.com/1/geo/id/247f43d441defc03.json
Libraries
● PHP
○ Twitter-async (https://github.com/jmathai/twitter-
async)
○ tmhOAuth (https://github.
com/themattharris/tmhOAuth)
○ Zend Framework (http://framework.zend.
com/manual/1.12/en/zend.service.twitter.html)
● Java
○ Twitter4J (http://twitter4j.org/)
https://dev.twitter.com/docs/twitter-libraries
Tools
● Twurl
○ https://github.com/marcel/twurl
○ "curl" for Twitter API
○ Manage access tokens (authentication)
● Apigee Console
○ https://apigee.com/console
○ Free console to execute APIs
Search API
● Similar to http://search.twitter.com
● Criteria
○ terms
○ geocode
○ language ("Language detection is best-effort")
○ count, until, since-id, max-id
○ result type: mixed, recent, popular
○ include entities
● Paginated !
○ you have to manage this by yourself
REST API
● Timelines
● Tweets
● Direct Messages
● Friends & Followers
● Users
● Suggested Users
● Favorites
● Lists
● Saved Searches
● Places & Geo
● Trends
● Spam Reporting
● OAuth
● Help
Streaming API
● Persistent HTTP connection
○ until you decide to close it
● Could be reeeeaaaaaaally huge !
○ Think about you architecture (hard and soft) !
○ Separate storage and consumption
● Only one stream opened at a time
● Could be tricky to managed
○ Use a library
Streaming API endpoints groups
● Public Streams
○ GET statuses/sample
○ POST statuses/filter
○ GET statuses/firehose (limited access)
● User Streams
○ Data and events for a specific user
● Site Streams (beta and limited access)
○ Real time update for large number of users
Twitter API
Keys for creating an awesome application !
https://twitter.com/zorrobiwan/status/341888609399480323

Mais conteúdo relacionado

Mais de La FeWeb

NoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedNoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedLa FeWeb
 
NoSQL: Quoi, quand et pour qui par Orlando Cassano du CETIC
NoSQL: Quoi, quand et pour qui par Orlando Cassano du CETICNoSQL: Quoi, quand et pour qui par Orlando Cassano du CETIC
NoSQL: Quoi, quand et pour qui par Orlando Cassano du CETICLa FeWeb
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICLa FeWeb
 
Usability & Wireframe par Nathalie Gouzée - Co-Founder Rubbik
Usability & Wireframe par Nathalie Gouzée - Co-Founder RubbikUsability & Wireframe par Nathalie Gouzée - Co-Founder Rubbik
Usability & Wireframe par Nathalie Gouzée - Co-Founder RubbikLa FeWeb
 
Introduction to Emolytics par David Hachez, Co-Founder GetSmily
Introduction to Emolytics par David Hachez, Co-Founder GetSmilyIntroduction to Emolytics par David Hachez, Co-Founder GetSmily
Introduction to Emolytics par David Hachez, Co-Founder GetSmilyLa FeWeb
 
Le community management pour les nuls par Louise Maton
Le community management pour les nuls par Louise MatonLe community management pour les nuls par Louise Maton
Le community management pour les nuls par Louise MatonLa FeWeb
 
RWD - Back to Basics par Ruben Pieraerts
RWD - Back to Basics par Ruben PieraertsRWD - Back to Basics par Ruben Pieraerts
RWD - Back to Basics par Ruben PieraertsLa FeWeb
 
Twitter Bootstrap par Antoine Guédès et Cédric Dussart
Twitter Bootstrap par Antoine Guédès et Cédric DussartTwitter Bootstrap par Antoine Guédès et Cédric Dussart
Twitter Bootstrap par Antoine Guédès et Cédric DussartLa FeWeb
 
Less CSS by Gauthier Eloy
Less CSS by Gauthier EloyLess CSS by Gauthier Eloy
Less CSS by Gauthier EloyLa FeWeb
 

Mais de La FeWeb (9)

NoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedNoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learned
 
NoSQL: Quoi, quand et pour qui par Orlando Cassano du CETIC
NoSQL: Quoi, quand et pour qui par Orlando Cassano du CETICNoSQL: Quoi, quand et pour qui par Orlando Cassano du CETIC
NoSQL: Quoi, quand et pour qui par Orlando Cassano du CETIC
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
 
Usability & Wireframe par Nathalie Gouzée - Co-Founder Rubbik
Usability & Wireframe par Nathalie Gouzée - Co-Founder RubbikUsability & Wireframe par Nathalie Gouzée - Co-Founder Rubbik
Usability & Wireframe par Nathalie Gouzée - Co-Founder Rubbik
 
Introduction to Emolytics par David Hachez, Co-Founder GetSmily
Introduction to Emolytics par David Hachez, Co-Founder GetSmilyIntroduction to Emolytics par David Hachez, Co-Founder GetSmily
Introduction to Emolytics par David Hachez, Co-Founder GetSmily
 
Le community management pour les nuls par Louise Maton
Le community management pour les nuls par Louise MatonLe community management pour les nuls par Louise Maton
Le community management pour les nuls par Louise Maton
 
RWD - Back to Basics par Ruben Pieraerts
RWD - Back to Basics par Ruben PieraertsRWD - Back to Basics par Ruben Pieraerts
RWD - Back to Basics par Ruben Pieraerts
 
Twitter Bootstrap par Antoine Guédès et Cédric Dussart
Twitter Bootstrap par Antoine Guédès et Cédric DussartTwitter Bootstrap par Antoine Guédès et Cédric Dussart
Twitter Bootstrap par Antoine Guédès et Cédric Dussart
 
Less CSS by Gauthier Eloy
Less CSS by Gauthier EloyLess CSS by Gauthier Eloy
Less CSS by Gauthier Eloy
 

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Twitter API's par Pascal Alberty, CTO de TweetWallPro

  • 1. Twitter API Keys for creating an awesome application !
  • 3. Twitter Dev Ecosystem ● Twitter success ○ Thanks Dev Community ! ● API ○ September 2006 ○ Very complete ○ Open ○ Free https://blog.twitter.com/2006/introducing-twitter-api
  • 4. The APIs ● APIs ○ Search API ○ REST API ○ Streaming API ○ https://dev.twitter.com/docs/history-rest-search-api ● Versions ○ API version 1 (almost deprecated) ○ API version 1.1
  • 6. Authentication ● OAuth ○ Each API request must be authorized ○ Access token on behalf of a Twitter user ● Obtaining access token ○ Sign in with Twitter ○ 3-legged OAuth ○ Pin based OAuth ○ dev.twitter.com ○ ... https://twitter.com/settings/applications
  • 8. Rate limiting ● Rate limit window duration ○ 15 minutes ● Requests allotted ○ per user ○ via application-only auth ● Example ○ GET statuses/user_timeline ○ per user: 150 requests per 15 minutes ○ via app: 300 requests per 15 minutes https://dev.twitter.com/docs/rate-limiting/1.1/limits
  • 9. Other technical limits ● Direct messages ○ 250 per day ● Tweets ○ 1,000 per day ○ Retweets are counted as Tweets. ● Changes to account email ○ Four per hour ● Following ○ 1,000 per day ● Following (account-based) ○ up to following 2,000 other users
  • 10. Platform objects ● Tweets can be found alone, within user objects, but most often within timelines ● Users can be found tweeting, following, and favoriting on Twitter ● Entities are most often found within Tweets ● Places can be found throughout the natural universe, but typically only appear attached to Tweets on Twitter
  • 11. Objects type ● JSON ! ● XML output will be dropped soon ○ Only JSON output with API 1.1 ● Be careful with ids (64 bits) ○ use String version (especially if using Javascript) ○ Twitpocalypse ■ https://dev.twitter.com/docs/twitter-ids-json-and-snowflake ○ Idpocalypse ■ https://dev.twitter.com/blog/64-bit-twitter-user-idpocalypse
  • 14. Entities / Entity Example ● Hashtags, Medias, URLs, User mentions, Symbols ● No need to parse ● Data used for display also (ex: display_url)
  • 16. Libraries ● PHP ○ Twitter-async (https://github.com/jmathai/twitter- async) ○ tmhOAuth (https://github. com/themattharris/tmhOAuth) ○ Zend Framework (http://framework.zend. com/manual/1.12/en/zend.service.twitter.html) ● Java ○ Twitter4J (http://twitter4j.org/) https://dev.twitter.com/docs/twitter-libraries
  • 17. Tools ● Twurl ○ https://github.com/marcel/twurl ○ "curl" for Twitter API ○ Manage access tokens (authentication) ● Apigee Console ○ https://apigee.com/console ○ Free console to execute APIs
  • 18. Search API ● Similar to http://search.twitter.com ● Criteria ○ terms ○ geocode ○ language ("Language detection is best-effort") ○ count, until, since-id, max-id ○ result type: mixed, recent, popular ○ include entities ● Paginated ! ○ you have to manage this by yourself
  • 19. REST API ● Timelines ● Tweets ● Direct Messages ● Friends & Followers ● Users ● Suggested Users ● Favorites ● Lists ● Saved Searches ● Places & Geo ● Trends ● Spam Reporting ● OAuth ● Help
  • 20. Streaming API ● Persistent HTTP connection ○ until you decide to close it ● Could be reeeeaaaaaaally huge ! ○ Think about you architecture (hard and soft) ! ○ Separate storage and consumption ● Only one stream opened at a time ● Could be tricky to managed ○ Use a library
  • 21. Streaming API endpoints groups ● Public Streams ○ GET statuses/sample ○ POST statuses/filter ○ GET statuses/firehose (limited access) ● User Streams ○ Data and events for a specific user ● Site Streams (beta and limited access) ○ Real time update for large number of users
  • 22. Twitter API Keys for creating an awesome application ! https://twitter.com/zorrobiwan/status/341888609399480323