Tag Archives: api

Twitter “OAuthcalypse” Coming This June

The Twitter OAuthcalypse is coming!

Twitter has announced to developers that they will be turning off basic HTTP authentication for the API on June 30, 2010 in favor of the more secure OAuth protocol. This shouldn’t cause too much trouble for most users, though developers of Twitter applications need to hurry up and update their software.

OAuth reduces the risk of password theft, as you don’t have to give applications your password. You will also get a higher API limit.

Hopefully Twitter will have Loren Brichter cook up a patch for Tweetie for Mac, as it does not yet support OAuth. (Tweetie for iPhone doesn’t either, but that’s guaranteed to be fixed right away, as it’s now the official Twitter app.)

Twitter @Anywhere Launches

Twitter just launched their new Twitter @Anywhere platform. It lets you “Integrate Twitter seamlessly into your site with just a few lines of JavaScript,” in a manner that reminds me of Facebook Connect. It provides various enhancements that bring the Twitter experience into your site.

The platform is just out of the bubble wrap, so there are more features and documentation coming soon, but the main features currently part of @Anywhere are:

  • Auto-linkification of usernames – The JavaScript API can automatically link anything that looks like a Twitter username to its corresponding Twitter profile. jQuery-style selectors can be used to fine-tune what gets auto-linkified.
  • Hoverboxes – If you hover over someone’s username on Twitter.com, a little thing called a “hoverbox” pops up, displaying the basic information about the account. Now you can have them on your site with a couple lines of code. This works well with the “auto-linkification.”
  • Follow buttons – Click the button, follow the account without ever leaving the page.
  • Tweet Box – Give your users a form, complete with 140-character counter, that lets them update their status. You can provide default text for the tweet, and a JavaScript callback can return the contents as either plain text or the final HTML output.
  • User login & signup – You’ve seen those “Facebook Connect” buttons before, whether on comment forms or as part of some other service that uses the Facebook API to get information or post to your profile. Twitter @Anywhere has something very similar. A way, using simple JavaScript, for users to connect their Twitter account to your site.

The question now is, what’s coming next. Could we be seeing an official retweet button as part of the @Anywhere platform? TweetMeme doesn’t use the new retweeting system yet, and Facebook offers a “Share” button and counter as part of their Connect platform. It seems like a logical step for Twitter to take.

Twitter Changing API URLs

Twitter is beginning the long process of changing their API root URLs from twitter.com/ to api.twitter.com/1/. This isn’t of much interest to ordinary Twitter users, but developers will need to update their applications sometime in the coming months.

The old URLs will continue to function for the foreseeable future, but Twitter wants to get developers using their new versioned URLs, to prevent potential foul-ups in the future, should they change something in a way that is less than backwards-compatible.

We haven’t yet determined how many versions will be supported at once or how long a version will continue to be supported once it’s deprecated. We’ll be figuring out answers to these questions once we spend some time supporting multiple versions and seeing how new APIs emerge and iterate. We suspect though that we’ll support deprecated versions for at least 6 months.

This is all part of their API version 2.0 roadmap.

Automated Website Thumbnails via WordPress.com

Ben Gillbanks has unearthed a neat, undocumented API. If you have a look at his WPVote site, you’ll note that next to each link there is a thumbnail or the originating site.

There are several services that can generate thumbnails like that, but most of them place watermarks on the images or place limits on how many API calls you can make in a month. (Amazon used to offer a paid service, but it was discontinued a year or two ago.)

To my surprise, when I was submitting an article to WPVote recently, I found that the thumbnails were served up by a subdomain of WordPress.com. I thought something along the lines of “Eh? I didn’t know they offered a screenshot service…” and continued about my business.

A couple days later, I spotted Ben’s blog post in my feed reader. In it he explained how he discovered a dynamic URL that Automattic uses, in places like the WordPress.org commercial themes page, to display thumbnails. He posted an email to Matt Mullenweg about it and got this as a response:

You can use it and link to it, but it’s not official. It’s not worth the effort to try to make it into a business – we have to support it anyway for our own apps.

Sounds good to me. :) Obviously it wouldn’t be nice to use it for something huge and high-traffic, but it seems like they don’t object to us smaller WordPress fanatics making use of it.


There’s now a WordPress plugin that makes it easy to use the thumbnails in blog posts, with a shortcode, or elsewhere with a template tag.

Working with RESTful Services in CodeIgniter

The modern web is full of APIs. Many interesting sites have been created by mashing up data sources from multiple “Web 2.0″ sites.

Net.Tuts+ has a new tutorial on Working with RESTful Services in CodeIgniter. I found it to be quite an interesting read, as it covers both accessing RESTful APIs and creating your own.

If you have been following the CodeIgniter From Scratch series you will know by now that it is relatively quick and easy to put together simple web applications, such as blogs, CMS systems, brochure sites, etc. One thing you may not have thought about is using CodeIgniter to create an interactive API. After trying several existing REST implementations, I found they not only lacked simplicity but were missing most of the features you would expect from a RESTful implementation; so I built my own. This tutorial will show you how to use this code to set up your REST API, and gives example of how to interact with it from your web application.

I’m always amazed by how simple it is to create fairly advanced applications with frameworks like CodeIgniter. It does take a little bit of practice to get used to coding within the guidelines, such as properly utilizing the MVC structure, but once you get the hang of it you can whip things up really fast.

An API for the Web: Learning YQL

I just read one of the most interesting articles Net.Tuts+ has published in the last few months: An API for the Web: Learning YQL.

Web apps and web services multiply like rabbits. They’re all fun to play with (like rabbits) and fun to integrate into other projects (unlike rabbits). But learning a new API every other day isn’t feasible or fun. And that’s the problem the Yahoo Query Language (YQL) is out to solve.

Think of YQL as the API for the web, the one API to rule them all. It’s not a hard one to learn, so let’s get you up to speed right now!

I couldn’t have said it better myself. YQL is just that: a wrapper for other APIs. It makes it easy to gather data from virtually any API, mash data up if necessary, and bring it into your own application. With generous daily query limits, and no commercial usage restrictions, what’s not to like?

A basic query to collect tweets from two twitter accounts would look like this:

SELECT * FROM twitter.status.timeline.user WHERE id in ('redwall_hp','fantasyfolder')

Very much like an SQL query, no? And there are “tables” to obtain data from many sources, such as Delicious, Netflix, Facebook, Flickr, Github, Last.fm, RSS feeds, etc.. Is there not a table for an API you need to use? You can create one.

Result sets can be returned as XML or JSON.

Developer tools like this and the BOSS search API, which is one of the available tables in YQL, are what I believe will keep Yahoo alive in the coming years.

Learning oEmbed

WoorkUp has an interesting post on oEmbed, and how you can use jQuery to take something like a YouTube or Flickr URL and automatically load the video or image on the page. Facebook uses this technique to fetch thumbnails and descriptions when you post a link.

WordPress 2.9 also includes oEmbed functionality, allowing you to easily add YouTube videos to your posts, simply by wrapping the video page’s URL in a pair of “embed” shortcode tags.

WoorkUp shows how you can implement the feature in your own projects.

Learning oEmbed: Convert Links Into Embedded Content [WoorkUp]

The Twitter API is For Twitter

Scott Gilbertson of Webmonkey’s MonkeyBites blog has an interesting post about the Twitter API, more specifically, on how some blog software providers are “borrowing” Twitter’s programmer interface to enable clients such as Tweetie to update your blog.

Twitter’s API has spawned hundreds of mashups and third party software apps, but now it’s growing even further — outside sites have begun mimicking an API to piggyback on Twitter clients.

It started last week with a clever hack by WordPress contributors which allows WordPress.com users to post and read their WordPress.com blogs through third-party Twitter apps like Tweetie 2 for the iPhone.

Now Tumblr has joined in on the fun, allowing you to post and read Tumblr blogs through any third-party Twitter app that allows you to change the API endpoint.

While that’s interesting, I don’t really like it. Emulating another service’s API will only result in problems as Twitter updates their API methods. Developers of Twitter clients will update their software, and companies like WordPress.com will have to be quick to re-work their fake Twitter API, otherwise things could break. It just seems like a bad plan to base something like that off of a third party’s proprietary framework, rather than that of an open standard.

Continue reading →

Modifying The Contextual Help Menu in WordPress

Contextual help menu in WordPressStarting in version 2.7, WordPress has a pull-down “Help” menu in the upper-right corner of the screen, often joined by another menu for configuring display options for the page in question.

By default the “Help” menu doesn’t do much. It gives some useful pointers on the Dashboard and Write screen, but other than that it pretty much just shows links to the Codex and WordPress.org support forums.

What if you wanted to make the “contextual menu” actually…contextual? If you’re a plugin or theme developer, you can add your own helpful information to the menu. It’s as simple as hooking into the contextual_help filter:

function my_contextual_help($text) {
$screen = $_GET['page'];
if ($screen == 'my_plugin') {
$text = "<h5>Need help with this plugin?</h5>";
$text .= "<p>Check out the documentation and support forums for help with this plugin.</p>";
$text .= "<a href=\"http://example.org/docs\">Documentation</a><br /><a href=\"http://example.org/support\">Support forums</a>";
return $text;

add_action('contextual_help', 'my_contextual_help');

The basic idea is to take the default contents of the menu, $text, and replace it with your own content. The $screen variable is used to make sure that the menu is only changed on the plugin’s pages, rather than universally through the Admin.

Count Your Retweets with the Tweetmeme API

I didn’t know this until recently, but Tweetmeme has an API for displaying the number of times and URL has been retweeted. A quick request to http://api.tweetmeme.com/url_info?url=[the URL] will return an XML, JSON or PHP response. You can pass the full URL as the argument, or a short URL that goes to the same place.

<title>Learning CSS Sprites</title>
<excerpt>Learning CSS Sprites http://bit.ly/3HlYUl</excerpt>

If you want to see a quick example of how you can use the API, have a look at this WP Recipes snippet: Display the number of tweets for each page or post.