SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
The Twitter API
     A Brief Tour


  Pe nnApps 2010
What is Twitter?

Twitter is simple

Subscribes to
philosophy, “Do one
thing and do it well”

Lets you share and
discuss your thoughts
through a community
you design
How is it used?
Have something to share? Send out a tweet.

Should be easy, seamless, ubiquitous

Any device (phone, tablet,
PC...)

Any method (web, app,
SMS...)

Tweets are your thoughts.
Think them, tweet them!
But wait!
Isn’t Twitter a website? Facebook is a
website...

You’re thinking too small

Twitter is a mode of communication!

Talking, writing, calling, emailing,
texting, and now, tweeting
Each has its own purpose, properties, and place
There’s just one problem...
Twitter is a web service

Tweets travel from you to your followers over the
good old World Wide Web

  Not through paper

  Not through your voice

  But through your very own, personal Internets

   Or whatever you decide to call it (not a truck)
So doesn’t this compromise
     its availability?
No.
The Internet is everywhere
More and more people have access to the Internet
wherever they go

 From their desk

 From their lap

 From their phone, on the go

Always on, always there

 Most people take this very fact for granted
Ubiquity
So I think I see what
you mean

With the ubiquity of
the web, a web
service becomes a
viable form of
communication...

...not constrained by
any context
Ubiquity
                          Still, something’s off
                          here...

                          I can access the web
                          from anywhere, sure

                          But is logging on to a
                          website the best way
                          to share my
                          thoughts?
How can Twitter be so natural and seamless if I
need a website to use it?
Answer: You don’t.
The Internet is everywhere
Again, you’re thinking too small

Twitter uses the Internet to work

But to the user, with ubiquitous web access, this is
just a minor implementation detail

No one really cares how calls work, or how texts
work, or even how talking works

They just want them to work
The Internet is everywhere
But the user does care about one
thing:

How to interact with the device to
use the service

   Some sort of interface is
   required

   But not just any

   Different form factors call for
   different interfaces
Ubiquity
                        So the Twitter service
                        itself must be
                        interface agnostic

                        The data itself must
                        be ubiquitous

                        Same data, same
                        ways to use it,
                        through any method
                        of interaction
How do we solve this problem?
Enter the Twitter API.
What is an API?
API stands for “Application Programming Interface”

It’s an interface for your interface

How does a user interact with an application?

  Through its user interface

How does the application interact with a service?

  Through an API
Too good to be true?
So Twitter lets you access and act on all the data
hosted by the service?

  For the most part, yes

  You just choose how you want to use it

But does it really work well?

  You be the judge

  Twitter certainly thinks it does...
Sounds great!
       I want to take it for a spin
       I want to build on top of
       Twitter

       What cool things can I do
       with it?

         Integrate Twitter into
         your app...

         ...or your site...

         ...or your device
Let’s get started.
Let’s get started
We’ll start with something simple

 The public timeline, accessible to anyone

 www.twitter.com/public_timeline

 If this is your first exposure to Twitter, it gets
 better, I promise

 Most of this stuff is useless...

 ...but so is “Hello World”
Hello, Twitter API
Let’s make our first API call to get the public
timeline

You’ve probably used a UNIX-like terminal on your
computer

  For some people, it’s all they use

Fire it up, and run the following command:

  curl http://twitter.com/statuses/
  public_timeline.rss
Hello, Twitter API
Neat!

Almost instantaneously, we’re presented with the
public timeline in beautiful XML

Let’s try something else

curl -u username:password http://
twitter.com/statuses/
friends_timeline.xml

Oops...
It’s not that easy...
This used to work...

...but there were some downsides

  Left user credentials exposed

  Limited in number of requests

  And what if the user changes his password...

  ...or changes his mind about the app?

Why not something better?
Enter OAuth.
What is OAuth?
       Stands for “Open
       Authorization”

       Uses tokens instead of
       credentials

       Once you request a token
       with your credentials,
       you’re good to go

       It’s that easy
But the implementation is a
bit tricky. So we’ll take our
            time.
Works like this
App Registration
OAuth is a little more “legit”

Want your application to access
Twitter?

You’ll have to register it first

Let’s do this now

  Hit up http://twitter.com/
  apps/new

  I’ll walk you through
Consumer Key and Secret
Alright, we’ve registered our app

Let’s look at some of the information Twitter has
provided us about it

  We’ll focus on two, which we use to sign our
  requests to Twitter

   Consumer Key

   Consumer Secret
Getting a Request Token
So far so good

The script that gets are request token is
getreqtok.php

So let’s run it via the Terminal

  cd /path/to/the/folder

  php getreqtok.php

Did it work?
Getting a Request Token
What did we get?

 A request token...

 ...and its accompanying secret

 Plus an authorization URL

So copy that URL and allow your new Twitter client
to access your Twitter account
OAuth Verification
This should give you an OAuth verification number

 Copy it down...

 ...and enter it into getacctok.php

What else do we need here?

 Our request token and secret

Now run the script

Here’s your access token!
Access Token
That’s it!

Really

Save this token somewhere, and you’re
authenticated for good

So how do we use it?

  Just include it with every API call you make

  Speaking of API calls, let’s try one
Making an API Call
Let’s pick something simple

Let’s try posting a tweet

Got our access token? Good

Open up tweet.php and find the API call

  statuses/update in post_tweet

  We’ll have to send our token along with every call

  Input your access token and its secret at the top
Posting a Tweet
We’re almost there!

Change $tweet to the tweet you want to send

And just run the script

  php tweet.php

Now refresh your Twitter account (using an
interface of your choosing..), and...
Voilà!
That wasn’t so bad!
Onwards
We’ve just scratched the surface

Practically anything you can think
of, you can do with the API

Go crazy!

But read the documentation first
(it’s good)

  http://dev.twitter.com/doc
Onwards
How can you go on from here?

Try out the different API calls

 Timeline

 User timeline

 User info

 Favorite tweets

 Direct messages
Onwards
Or try out different interfaces and form factors

 Something like what we’ve done using PHP
 would be great for a web app

 But what about a desktop client?

 Or a phone client?

 The API’s got you covered
Case Study: Birdfeed

I’m using the Twitter API
myself

The iPhone has some great
Twitter apps

But I think I can come up
with something better
Enter Birdfeed.
MGTwitterEngine
iPhone applications are written
in Cocoa, a framework usually
used with Objective-C

With Cocoa, using the Twitter
API directly is a bit unruly

With the open source
MGTwitterEngine, developed by
Matt Gemmell, you get a natural,
Cocoa-like way to use the API
MGTwitterEngine
The OAuth token flow works
almost exactly the same

 But uses an interface within the
 app for logging in

Once the user logs in, the token is
retrieved behind the scenes

The token is saved, and that’s it
for authentication
MGTwitterEngine

All of the API calls are performed
with a traditional Cocoa message
passing syntax to an instance of
your Twitter engine

For example, this will return a list
of tweets from the user’s home
timeline, ready to be displayed
Case Study: Birdfeed
Birdfeed is all about creating the best designed
Twitter experience on the iPhone

“Design isn’t just how it looks...it’s how it works.”

Ways to make this happen

  Intuitive, frictionless “pick up and do” interface

  No meaningless cruft (shortened links,
  @usernames)

Communication is human, and Twitter should be too
Case Study: Birdfeed
What’s cool about this?

Ironically, the Twitter API was written in such a way
that using it is what I care about the least

The high level of abstraction lets me not even think
about how I’m interacting with data

Instead, gives me full focus on creating a user
experience I think people will really love.
What will you do with the
      Twitter API?
Something important, say...
...winning PennApps?
The end.
Jordan Kay's Twitter API tour

Weitere ähnliche Inhalte

Was ist angesagt?

Automation Demystified
Automation DemystifiedAutomation Demystified
Automation DemystifiedMichael King
 
Automated Blog Profits
Automated Blog ProfitsAutomated Blog Profits
Automated Blog Profitshomebizoutlook
 
The Thin Line Between Seth Godin & Neil Strauss
The Thin Line Between Seth Godin & Neil StraussThe Thin Line Between Seth Godin & Neil Strauss
The Thin Line Between Seth Godin & Neil StraussMichael King
 
DeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a ChatbotDeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a ChatbotTessa Mero
 
Test ideas for Login / Authentication and Login Session
Test ideas for Login / Authentication and Login SessionTest ideas for Login / Authentication and Login Session
Test ideas for Login / Authentication and Login SessionSanthosh Tuppad
 
How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)Hani Nurrahmi
 
TechSEO Boost: Machine Learning for SEOs
TechSEO Boost: Machine Learning for SEOsTechSEO Boost: Machine Learning for SEOs
TechSEO Boost: Machine Learning for SEOsCatalyst
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction toSayed Ahmed
 
TechSEO Boost 2018: The Statelessness of Technical SEO
TechSEO Boost 2018: The Statelessness of Technical SEOTechSEO Boost 2018: The Statelessness of Technical SEO
TechSEO Boost 2018: The Statelessness of Technical SEOCatalyst
 
What an RP Wants, Part 2
What an RP Wants, Part 2What an RP Wants, Part 2
What an RP Wants, Part 2Joseph Smarr
 
TechSEO Boost 2018: Programming Basics for SEOs
TechSEO Boost 2018: Programming Basics for SEOsTechSEO Boost 2018: Programming Basics for SEOs
TechSEO Boost 2018: Programming Basics for SEOsCatalyst
 
Generating Qualitative Content with GPT-2 in All Languages
Generating Qualitative Content with GPT-2 in All LanguagesGenerating Qualitative Content with GPT-2 in All Languages
Generating Qualitative Content with GPT-2 in All LanguagesCatalyst
 
Developer connect - microservices
Developer connect - microservicesDeveloper connect - microservices
Developer connect - microservicesAnton McConville
 
What Social Media should I use for presenting my work or for blogging?
What Social Media should I use for presenting my work or for blogging?What Social Media should I use for presenting my work or for blogging?
What Social Media should I use for presenting my work or for blogging?Socialconsulting.gr
 

Was ist angesagt? (17)

Automation Demystified
Automation DemystifiedAutomation Demystified
Automation Demystified
 
Automated Blog Profits
Automated Blog ProfitsAutomated Blog Profits
Automated Blog Profits
 
The Thin Line Between Seth Godin & Neil Strauss
The Thin Line Between Seth Godin & Neil StraussThe Thin Line Between Seth Godin & Neil Strauss
The Thin Line Between Seth Godin & Neil Strauss
 
tinder automation
tinder automationtinder automation
tinder automation
 
DeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a ChatbotDeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a Chatbot
 
Test ideas for Login / Authentication and Login Session
Test ideas for Login / Authentication and Login SessionTest ideas for Login / Authentication and Login Session
Test ideas for Login / Authentication and Login Session
 
How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)
 
TechSEO Boost: Machine Learning for SEOs
TechSEO Boost: Machine Learning for SEOsTechSEO Boost: Machine Learning for SEOs
TechSEO Boost: Machine Learning for SEOs
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction to
 
TechSEO Boost 2018: The Statelessness of Technical SEO
TechSEO Boost 2018: The Statelessness of Technical SEOTechSEO Boost 2018: The Statelessness of Technical SEO
TechSEO Boost 2018: The Statelessness of Technical SEO
 
What an RP Wants, Part 2
What an RP Wants, Part 2What an RP Wants, Part 2
What an RP Wants, Part 2
 
Assingment 3 - Bug bounty
Assingment 3 - Bug bountyAssingment 3 - Bug bounty
Assingment 3 - Bug bounty
 
TechSEO Boost 2018: Programming Basics for SEOs
TechSEO Boost 2018: Programming Basics for SEOsTechSEO Boost 2018: Programming Basics for SEOs
TechSEO Boost 2018: Programming Basics for SEOs
 
If This Then What
If This Then WhatIf This Then What
If This Then What
 
Generating Qualitative Content with GPT-2 in All Languages
Generating Qualitative Content with GPT-2 in All LanguagesGenerating Qualitative Content with GPT-2 in All Languages
Generating Qualitative Content with GPT-2 in All Languages
 
Developer connect - microservices
Developer connect - microservicesDeveloper connect - microservices
Developer connect - microservices
 
What Social Media should I use for presenting my work or for blogging?
What Social Media should I use for presenting my work or for blogging?What Social Media should I use for presenting my work or for blogging?
What Social Media should I use for presenting my work or for blogging?
 

Ähnlich wie Jordan Kay's Twitter API tour

How I solved my NYC parking problem with Python
How I solved my NYC parking problem with PythonHow I solved my NYC parking problem with Python
How I solved my NYC parking problem with PythonTwitter Developers
 
Webhooks, Asynchronous Web Applications and Push Notifications
Webhooks, Asynchronous Web Applications and Push NotificationsWebhooks, Asynchronous Web Applications and Push Notifications
Webhooks, Asynchronous Web Applications and Push Notificationsmontagetalent
 
Intro Course Online Sales & Marketing - Part2
Intro Course Online Sales & Marketing - Part2Intro Course Online Sales & Marketing - Part2
Intro Course Online Sales & Marketing - Part2rregter
 
OAuth for your API - The Big Picture
OAuth for your API - The Big PictureOAuth for your API - The Big Picture
OAuth for your API - The Big PictureApigee | Google Cloud
 
Chatbot for Railway using Diloug Flow
Chatbot for Railway using Diloug FlowChatbot for Railway using Diloug Flow
Chatbot for Railway using Diloug Flowijtsrd
 
When e-commerce meets Symfony
When e-commerce meets SymfonyWhen e-commerce meets Symfony
When e-commerce meets SymfonyMarc Morera
 
Microservices rubyconf-2013
Microservices rubyconf-2013Microservices rubyconf-2013
Microservices rubyconf-2013Mohit Thatte
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleSandeep Hijam
 
Web Hooks Google Tech Talk
Web Hooks Google Tech TalkWeb Hooks Google Tech Talk
Web Hooks Google Tech TalkJeff Lindsay
 
Web Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of TomorrowWeb Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of TomorrowGoogleTecTalks
 
Conversational experience by Systango
Conversational experience by SystangoConversational experience by Systango
Conversational experience by SystangoSystango
 
IoT Printer (2012)
IoT Printer (2012)IoT Printer (2012)
IoT Printer (2012)lazyatom
 
Eating our own Dogfood - Twitter Mobile
Eating our own Dogfood - Twitter MobileEating our own Dogfood - Twitter Mobile
Eating our own Dogfood - Twitter Mobilelrechis
 
Conversational Experiences for Humans
Conversational Experiences for HumansConversational Experiences for Humans
Conversational Experiences for HumansSebastian Krumhausen
 
Twet Application
Twet ApplicationTwet Application
Twet Applicationymark
 
UX 101: User Research methods to kickstart your project
UX 101: User Research methods to kickstart your projectUX 101: User Research methods to kickstart your project
UX 101: User Research methods to kickstart your projectCharlotte Breton Schreiner
 
WebHooks in 10 Minutes
WebHooks in 10 MinutesWebHooks in 10 Minutes
WebHooks in 10 MinutesJeff Lindsay
 

Ähnlich wie Jordan Kay's Twitter API tour (20)

How I solved my NYC parking problem with Python
How I solved my NYC parking problem with PythonHow I solved my NYC parking problem with Python
How I solved my NYC parking problem with Python
 
Webhooks, Asynchronous Web Applications and Push Notifications
Webhooks, Asynchronous Web Applications and Push NotificationsWebhooks, Asynchronous Web Applications and Push Notifications
Webhooks, Asynchronous Web Applications and Push Notifications
 
Intro Course Online Sales & Marketing - Part2
Intro Course Online Sales & Marketing - Part2Intro Course Online Sales & Marketing - Part2
Intro Course Online Sales & Marketing - Part2
 
OAuth for your API - The Big Picture
OAuth for your API - The Big PictureOAuth for your API - The Big Picture
OAuth for your API - The Big Picture
 
Chatbot for Railway using Diloug Flow
Chatbot for Railway using Diloug FlowChatbot for Railway using Diloug Flow
Chatbot for Railway using Diloug Flow
 
When e-commerce meets Symfony
When e-commerce meets SymfonyWhen e-commerce meets Symfony
When e-commerce meets Symfony
 
Microservices rubyconf-2013
Microservices rubyconf-2013Microservices rubyconf-2013
Microservices rubyconf-2013
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
 
Web Hooks Google Tech Talk
Web Hooks Google Tech TalkWeb Hooks Google Tech Talk
Web Hooks Google Tech Talk
 
Web Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of TomorrowWeb Hooks And The Programmable World Of Tomorrow
Web Hooks And The Programmable World Of Tomorrow
 
Hacking For Innovation
Hacking For InnovationHacking For Innovation
Hacking For Innovation
 
Conversational experience by Systango
Conversational experience by SystangoConversational experience by Systango
Conversational experience by Systango
 
IoT Printer (2012)
IoT Printer (2012)IoT Printer (2012)
IoT Printer (2012)
 
Eating our own Dogfood - Twitter Mobile
Eating our own Dogfood - Twitter MobileEating our own Dogfood - Twitter Mobile
Eating our own Dogfood - Twitter Mobile
 
Clever Messenger Review
Clever Messenger Review Clever Messenger Review
Clever Messenger Review
 
Conversational Experiences for Humans
Conversational Experiences for HumansConversational Experiences for Humans
Conversational Experiences for Humans
 
Twet Application
Twet ApplicationTwet Application
Twet Application
 
Ifttt
IftttIfttt
Ifttt
 
UX 101: User Research methods to kickstart your project
UX 101: User Research methods to kickstart your projectUX 101: User Research methods to kickstart your project
UX 101: User Research methods to kickstart your project
 
WebHooks in 10 Minutes
WebHooks in 10 MinutesWebHooks in 10 Minutes
WebHooks in 10 Minutes
 

Kürzlich hochgeladen

Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 

Kürzlich hochgeladen (20)

Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 

Jordan Kay's Twitter API tour

  • 1. The Twitter API A Brief Tour Pe nnApps 2010
  • 2. What is Twitter? Twitter is simple Subscribes to philosophy, “Do one thing and do it well” Lets you share and discuss your thoughts through a community you design
  • 3. How is it used? Have something to share? Send out a tweet. Should be easy, seamless, ubiquitous Any device (phone, tablet, PC...) Any method (web, app, SMS...) Tweets are your thoughts. Think them, tweet them!
  • 4. But wait! Isn’t Twitter a website? Facebook is a website... You’re thinking too small Twitter is a mode of communication! Talking, writing, calling, emailing, texting, and now, tweeting Each has its own purpose, properties, and place
  • 5. There’s just one problem... Twitter is a web service Tweets travel from you to your followers over the good old World Wide Web Not through paper Not through your voice But through your very own, personal Internets Or whatever you decide to call it (not a truck)
  • 6. So doesn’t this compromise its availability?
  • 7. No.
  • 8. The Internet is everywhere More and more people have access to the Internet wherever they go From their desk From their lap From their phone, on the go Always on, always there Most people take this very fact for granted
  • 9. Ubiquity So I think I see what you mean With the ubiquity of the web, a web service becomes a viable form of communication... ...not constrained by any context
  • 10. Ubiquity Still, something’s off here... I can access the web from anywhere, sure But is logging on to a website the best way to share my thoughts? How can Twitter be so natural and seamless if I need a website to use it?
  • 12. The Internet is everywhere Again, you’re thinking too small Twitter uses the Internet to work But to the user, with ubiquitous web access, this is just a minor implementation detail No one really cares how calls work, or how texts work, or even how talking works They just want them to work
  • 13. The Internet is everywhere But the user does care about one thing: How to interact with the device to use the service Some sort of interface is required But not just any Different form factors call for different interfaces
  • 14. Ubiquity So the Twitter service itself must be interface agnostic The data itself must be ubiquitous Same data, same ways to use it, through any method of interaction How do we solve this problem?
  • 16. What is an API? API stands for “Application Programming Interface” It’s an interface for your interface How does a user interact with an application? Through its user interface How does the application interact with a service? Through an API
  • 17. Too good to be true? So Twitter lets you access and act on all the data hosted by the service? For the most part, yes You just choose how you want to use it But does it really work well? You be the judge Twitter certainly thinks it does...
  • 18. Sounds great! I want to take it for a spin I want to build on top of Twitter What cool things can I do with it? Integrate Twitter into your app... ...or your site... ...or your device
  • 20. Let’s get started We’ll start with something simple The public timeline, accessible to anyone www.twitter.com/public_timeline If this is your first exposure to Twitter, it gets better, I promise Most of this stuff is useless... ...but so is “Hello World”
  • 21. Hello, Twitter API Let’s make our first API call to get the public timeline You’ve probably used a UNIX-like terminal on your computer For some people, it’s all they use Fire it up, and run the following command: curl http://twitter.com/statuses/ public_timeline.rss
  • 22. Hello, Twitter API Neat! Almost instantaneously, we’re presented with the public timeline in beautiful XML Let’s try something else curl -u username:password http:// twitter.com/statuses/ friends_timeline.xml Oops...
  • 23. It’s not that easy... This used to work... ...but there were some downsides Left user credentials exposed Limited in number of requests And what if the user changes his password... ...or changes his mind about the app? Why not something better?
  • 25. What is OAuth? Stands for “Open Authorization” Uses tokens instead of credentials Once you request a token with your credentials, you’re good to go It’s that easy
  • 26. But the implementation is a bit tricky. So we’ll take our time.
  • 28. App Registration OAuth is a little more “legit” Want your application to access Twitter? You’ll have to register it first Let’s do this now Hit up http://twitter.com/ apps/new I’ll walk you through
  • 29. Consumer Key and Secret Alright, we’ve registered our app Let’s look at some of the information Twitter has provided us about it We’ll focus on two, which we use to sign our requests to Twitter Consumer Key Consumer Secret
  • 30. Getting a Request Token So far so good The script that gets are request token is getreqtok.php So let’s run it via the Terminal cd /path/to/the/folder php getreqtok.php Did it work?
  • 31. Getting a Request Token What did we get? A request token... ...and its accompanying secret Plus an authorization URL So copy that URL and allow your new Twitter client to access your Twitter account
  • 32. OAuth Verification This should give you an OAuth verification number Copy it down... ...and enter it into getacctok.php What else do we need here? Our request token and secret Now run the script Here’s your access token!
  • 33. Access Token That’s it! Really Save this token somewhere, and you’re authenticated for good So how do we use it? Just include it with every API call you make Speaking of API calls, let’s try one
  • 34. Making an API Call Let’s pick something simple Let’s try posting a tweet Got our access token? Good Open up tweet.php and find the API call statuses/update in post_tweet We’ll have to send our token along with every call Input your access token and its secret at the top
  • 35. Posting a Tweet We’re almost there! Change $tweet to the tweet you want to send And just run the script php tweet.php Now refresh your Twitter account (using an interface of your choosing..), and...
  • 38. Onwards We’ve just scratched the surface Practically anything you can think of, you can do with the API Go crazy! But read the documentation first (it’s good) http://dev.twitter.com/doc
  • 39. Onwards How can you go on from here? Try out the different API calls Timeline User timeline User info Favorite tweets Direct messages
  • 40. Onwards Or try out different interfaces and form factors Something like what we’ve done using PHP would be great for a web app But what about a desktop client? Or a phone client? The API’s got you covered
  • 41. Case Study: Birdfeed I’m using the Twitter API myself The iPhone has some great Twitter apps But I think I can come up with something better
  • 43. MGTwitterEngine iPhone applications are written in Cocoa, a framework usually used with Objective-C With Cocoa, using the Twitter API directly is a bit unruly With the open source MGTwitterEngine, developed by Matt Gemmell, you get a natural, Cocoa-like way to use the API
  • 44. MGTwitterEngine The OAuth token flow works almost exactly the same But uses an interface within the app for logging in Once the user logs in, the token is retrieved behind the scenes The token is saved, and that’s it for authentication
  • 45. MGTwitterEngine All of the API calls are performed with a traditional Cocoa message passing syntax to an instance of your Twitter engine For example, this will return a list of tweets from the user’s home timeline, ready to be displayed
  • 46. Case Study: Birdfeed Birdfeed is all about creating the best designed Twitter experience on the iPhone “Design isn’t just how it looks...it’s how it works.” Ways to make this happen Intuitive, frictionless “pick up and do” interface No meaningless cruft (shortened links, @usernames) Communication is human, and Twitter should be too
  • 47. Case Study: Birdfeed What’s cool about this? Ironically, the Twitter API was written in such a way that using it is what I care about the least The high level of abstraction lets me not even think about how I’m interacting with data Instead, gives me full focus on creating a user experience I think people will really love.
  • 48. What will you do with the Twitter API? Something important, say...