Farm Development

How To Get Started Writing Open Social Applications

I started learning about Google's Open Social API and gave a lightning talk on it at the last Chicago Python User Group meeting. It wasn't much more than a brief overview and fodder for "diving in" to the Open Social platform. Here it is again, in more of a tutorial form, so dive in!

What Is It?

It's a set of programming interfaces to let you build "applications" that run inside social networking websites. By applications, think "widgets." The interfaces consist of a JavaScript API to build the screens and interactivity and a REST API (Atom publishing API + XML) for the "container" site to implement.

The official "container" sites so far include Friendster, MySpace, Orkut (Google's own), Hi5, Ning, and several others. Some interesting facts from the video : Orkut has an overwhelming presence in Brazil and India and Hi5 is the largest Spanish-speaking social site. Ning is unique in that it's a "meta" social site. It's a social site that enables you to build your own social sites until your head explodes.

The Role of An Open Social Application

I predict that the dark energy of the universe (that is, energy generated by the free time of cunning web developers like you and I) will bring hundreds of cool social apps into existence. It's the same collaboration concept that makes open source software so successful. And more similarly, what makes Firefox so customizable through Extensions. This kind of thing gets me excited about the Web reminiscent of when RSS became a standard. To be honest, I don't think social networking is that interesting and I am still waiting for the fad to die out, but Open Social might encourage other sites to standardize additional container/application APIs.

Let's See Some Code

To test out an Open Social app you can use the Orkut Sandbox. It needs to conform to the Google Gadget API; here is the simplest app you can build:

<?xml version="1.0" encoding="UTF-8" ?>
<ModulePrefs title="Boring Hello App">
    <Require feature="opensocial-0.5"/>
<Content type="html">
    <script type="text/javascript">
    function start_hello() {
        document.getElementById('message').innerHTML = "Hello!";

    <div id="message"> </div>

Since this isn't very exciting and doesn't show off and of the API features, there are plenty more examples in the Open Social docs.

Some Gotchas

The Orkut sandbox has a fierce cache. To use your application uncached, you have to add this on to the end of your app's URL:


Since the app is just HTML, you can use the script tag to pull in 3rd party JavaScript libraries. But keep in mind you will face some problems due to to JavaScript's Same Origin security policy. Although, the JavaScript libs automatically available will probably let you do most of the remote-call things you need, like fetching JSON. There also might be some workarounds with the Dojo framework's iframe strategy.

Have fun!

Note: HTML tags will be stripped. Hit enter twice for a new paragraph.

Recent Projects

  • JSTestNet

    Like botnet but for JS tests in CI.

  • Nose Nicedots

    Nose plugin that prints nicer dots.

  • Fudge

    Mock objects for testing.

  • Fixture

    Loading and referencing test data.

  • NoseJS

    Nose plugin that runs JavaScript tests for a Python project.

  • Wikir

    converts reST to various Wiki formats.