David Corbacho

Twitter API v1 will be 410 Gone.

The end is nigh. Starting March 5th, 2013 Twitter is stopping the support for unauthenticated requests, i.e. turning off the API v1 and RSS/Atom feeds.

Twitter wants that we authenticate every request with OAuth for the API v1.1, that only supports JSON.

It's the end of an era. I will be nostalgic for the days when it was so easy to fetch and parse JSON from Twitter. All those tutorials in the web will be lost in time...

Twitter mercifully warned us long time ago, on August 2012. But it's totally understandable for us, developers, to leave it for later. Deadlines are our thing.

The plan for API v1’s Retirement

This is the important link: read this Twitter plan and check new updates in the Announcements section, it will be updated frequently with more information during the next days.

We will perform the first of what we call "blackout tests" for API v1 on March 5th, 2013. [...] from around 9:00am to 10:00am PST

All unauthenticated requests during that time window will be responded to with a HTTP 410 Gone.

Over the next few weeks we'll be announcing additional blackout tests and a more detailed schedule regarding the retirement of API v1.

Modules for Drupal

You should be using in your Drupal site the last version of Twitter module, then you will be safe. Thanks to my mate juampy for implementing all the new changes and maintaining this awesome module for Drupal 6 and 7.

If your Drupal site is using the easy and light-weight Twitter Pull module (10K installations), this module is based on the Twitter API v1, so it will stop working.
Some days ago the maintainer has committed a patch to make work Twitter Pull module loading the twitter.inc file from the Twitter module.

In that same issue, I saw Boriana Ditcheva gave really good instructions on how to switch to the Twitter module. I asked her permission to publish them here, and she gladly agree. Thank you!, here it goes:

Instructions to switch to Twitter module

  1. Go to https://dev.twitter.com, login with the twitter username you'll want to pull tweets from and add your website as a new application! This is needed so your website is identified as an application that can communicate with your twitter account once the new authentication requirements are in full effect. Then you'll have the consumer key/secret the twitter module uses to login.

    Choose 'Read Only' for the access if you'll only be pulling tweets (versus posting tweets). I'm assuming we're only in that boat, since we chose the twitter_pull module in the first place.
  2. Download and enable the OAuth and Twitter modules.
  3. Go to Admin --> Configuration --> Web Services --> Twitter --> Settings and paste in the consumer key & secret you got when you added your website as an application to interact with your twitter account above
  4. Now go to the 'Twitter' tab of the configuration screen. I had a hard time getting this to work on localhost, since it seems that the 'Website' and 'Callback' URLs on the twitter application side have to match what's listed in the settings tab of this module. Something like http://YOURSITE.com/twitter/oauth. Since I was working on localhost, it would not accept that as a URL, and I had to end up doing this all on my test site that's actually online!!!. Once you've got that part figured out though, click here to add a new user, and just make sure you're logged into the twitter account you want to add.
  5. Check the 'Tweet' or 'Tweet' and 'Mention' options next to the user, once you add them, depending on what you want to download.
  6. Now go to the 'Views' section of your website and either modify or clone-then-modify the views that come with this module, until you get them looking similarly to what your twitter_pull blocks looked like.... I had to re-do some of my custom styling, but now it looks identical. Hooray

Drupal Themes

Yes. Drupal Themes. Because it was so easy to pull tweets from the Twitter API v1, there are themes that have a feature "Show the last tweet". For example, it comes to my mind the theme 960 Robots.

More?

Do you have any other tip about upgrading to API v1.1 ? I will update this post with new information and your suggestions.

Update 1.
Juampy created this issue pointing to modules that are still are using the Twitter API v1, and suggested a quick fix for these modules, loading a file from the Twitter module:

// Connect to twitter.com and retrieve favorite tweets.
module_load_include('inc', 'twitter');

Robin Millette posted in the comments this useful list of Twitter related modules from groups.drupal.org.

Update 2. [5th of March]
Joel Collins pointed in the comments that in a dev server or localhost (without public domain), you can use http://127.0.0.1:8000/twitter/oauth for the Callback URL, as said in the Twitter installation docs. This way you won't get anymore the error "Could not obtain a valid token from the Twitter API. Please review the configuration".

Update 3 [6th of March]
There is a discussion thread in Twitter where @episod is answering questions.
For example, look in your code (or whatever library you're using) for API v1 calls, that has the following URL patterns (http or https):

http://api.twitter.com/1/*
http://search.twitter.com/search.*
http://twitter.com/* 

If the API call isn't going to https://api.twitter.com/1.1/*, then it's probably an API v1-era call.

Update 4 [14th of March]
The next blackout test will be March 20, 2013 from 3:00pm to 4:00pm Pacific.
Check also Twitter Announcements.