Creating a Twitter application

Twitter is the ubiquitous microblogging social media platform with 253 million active members as of 2014. Fortunately for us, Twitter makes the service's data more open and available to third parties than just about any other social media site of similar size and standing in the tech community. Additionally, Twitter offers a rich and user-friendly RESTful API that we will make use of extensively. This recipe will show you how to create a new Twitter application, which is a required step to access Twitter data programmatically.

Getting ready

Make sure that you have a web browser installed, and open up a new browser tab or window.

How to do it...

The following steps will walk you through the creation of a new Twitter application:

Tip

Note that Twitter does like to update its user interface (UI) frequently and these steps, or the web-based forms, might change accordingly.

  1. First, make sure that you have created a Twitter account. If you have not created one, go to http://twitter.com and sign up. If you have an account, simply log in to your Twitter account with your web browser.
  2. Next, go to https://dev.twitter.com/apps and select the light blue button labeled Create an Application on the right-hand side of the screen.
    How to do it...
  3. Here, it will prompt you to enter your application details in three mandatory fields and one optional one. Choose a name for your application that is no more than 32 characters.
  4. Next, supply a brief description of your application between 10 and 200 characters.
  5. You must supply a website for your application, although it is not applicable for our use case. Also, there is a specific format that is required for the form to be submitted successfully. Enter http://127.0.0.1.
  6. Finally, you can ignore the Callback URL field, which is the last field on the form.
  7. Go ahead and take some time to read the Developer Rules of the Road section, as this document details in plain and simple text what you should and should not do using your application.
  8. Click on the Create your Twitter Application. After a few moments, you should be on the main settings page of your new application with a tabbed menu at the top of the screen. The current tab should be labeled Details.
  9. Click on the API Keys tab and you should see the following screenshot:
    How to do it...
  10. Now, click on Create my access token in the Token actions gray box at the bottom to authorize your application for your own account (you might have to click the button more than once). The result should look like the following screenshot:
    How to do it...
  11. Record the API key, API secret, access token, and access token secret in a text file. These are important but must be protected like you would protect your e-mail password or ATM pin. You can take a screenshot to save the information, but it would be easier to copy and paste these values into a text file for now.

Tip

Now that you have MinGW and MSYS, there's no need to be jealous of those with a Linux installation anymore, since they implement in your system the most important parts of a Linux development environment.

How it works...

You might be asking yourself why we needed to create an application if all we want to do is to pull some simple data from Twitter. Early versions (1.0 and before) of the Twitter API allowed applications to make anonymous API requests, retrieving data from Twitter without Twitter knowing who was actually making the request. Since the deprecated Version 1.0 of the company's API was retired on June 11, 2013, all API requests to Twitter require authentication. This allows Twitter to keep track of who requests what information and how much information was requested.

In general, there are several signs in the industry that the halcyon days of social media data harvesting might be waning. Facebook's newest set of APIs, specifically Version 2.0 of Facebook Login, has strongly locked down what data can be obtained from the social graph. Further, Twitter acquired Gnip in April, 2014; Gnip is a reseller of Twitter data, and it allows its customers to buy large portions of Twitter data. This move suggests that Version 2.0 of the Twitter API might limit further access to Twitterverse.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.94.249