Database Reference
In-Depth Information
As the Public streams API is the most versatile Streaming API, we will use it in
all the examples pertaining to Streaming API.
In this chapter, we illustrate how the aforementioned types of information can be
collected using both forms of Twitter API. Requests to the APIs contain parameters
which can include hashtags, keywords, geographic regions, and Twitter user IDs. We
will explain the use of parameters in greater detail in the context of specific APIs
later in the chapter. Responses from Twitter APIs is in JavaScript Object Notation
(JSON) format. 3 JSON is a popular format that is widely used as an object notation
on the web.
Twitter APIs can be accessed only via authenticated requests. Twitter uses Open
Authentication and each request must be signed with valid Twitter user credentials.
Access to Twitter APIs is also limited to a specific number of requests within a time
window called the rate limit . These limits are applied both at individual user level
as well as at the application level. A rate limit window is used to renew the quota of
permitted API calls periodically. The size of this window is currently 15 min.
We begin our discussion with a brief introduction to OAuth.
2.1
Introduction to Open Authentication (OAuth)
Open Authentication (OAuth) is an open standard for authentication, adopted by
Twitter to provide access to protected information. Passwords are highly vulner-
able to theft and OAuth provides a safer alternative to traditional authentication
approaches using a three-way handshake. It also improves the confidence of the
user in the application as the user's password for his Twitter account is never shared
with third-party applications.
The authentication of API requests on Twitter is carried out using OAuth.
Figure 2.1 summarizes the steps involved in using OAuth to access Twitter API.
Twitter APIs can only be accessed by applications. Below we detail the steps for
making an API call from a Twitter application using OAuth:
1. Applications are also known as consumers and all applications are required to
register themselves with Twitter. 4 Through this process the application is issued
a consumer key and secret which the application must use to authenticate itself
to Twitter.
2. The application uses the consumer key and secret to create a unique Twitter link
to which a user is directed for authentication. The user authorizes the application
by authenticating himself to Twitter. Twitter verifies the user's identity and issues
a OAuth verifier also called a PIN.
3 http://en.wikipedia.org/wiki/JSON
4 Create your own application at http://dev.twitter.com
Search WWH ::




Custom Search