Introduction to OpenSocial API

Probably I would be the most late comer writing about the OpnSocial but I still think there is no full-blown information available about OpenSocial at one place. In this post I am trying to collect all the possible information about OpenSocial in short.

‘OpenSocial is a set of common APIs (Introduced & led by Google Inc. along with its partners like Yahoo, Ning, Hi5, LinkedIn, MySpace & Plaxo) for web-based social networking applications which enable social networks to host third-party application(HTML/JavaScript & may embed Flash) with in them and provides ability to third-party application developer to host their application on multiple social networks(OpenSocial)’.  Please see OpenSocial on Wikipedia (http://en.wikipedia.org/wiki/Open_social) for complete history and background. However there is an official wiki for OpenSocial(http://wiki.opensocial.org/index.php?title=Main_Page). The goal behind to develop OpenSocial was having a common standard of application development ‘Learn once, run anywhere’.

There are two parts of OpenSocial:

  1. For social networks – to become a OpenSocial application container to run the third-party application
  2. Application developer – to write the applications in simple HTML/JavaScript applications tu run inside the OpenSocial container.

There were initially three APIs in OpenSocial:

* People/Friend – To get user/user’s friends details/list
* Activities – To get user’s/user’s friend’s activities
* Application data – to get application related data of user/user’s friends

However there are some addition to the API list like Group, Message & Albums in the APIs list. you can see the specification for more detailed list (here http://opensocial-resources.googlecode.com/svn/spec/1.0/Social-Data.xml). Anybody can contribute to the OpenSocial specification and give suggestions on the official discussion forum of OpenSocial (http://groups.google.com/group/opensocial-and-gadgets-spec)

Below is the basic example application ‘Hello World’:

xml version=”1.0″ encoding=”UTF-8″ ?>

<Module>

<ModulePrefs title=”Hello World!”>

<Require feature=”opensocial-0.8″ />

<!–ModulePrefs>

<Content type=”html”>

<!–[CDATA[-->

<h1>Hello, world!</h1>

]]>

</Content>

</Module>

You can see its purely in XML including HTML in <!–[CDATA[ ]]–>. You can also embed JavaScript in your application. Like this:

<?xml version=”1.0″ encoding=”UTF-8″ ?>

<Module>

<ModulePrefs title=”Hello World!”>

<Require feature=”opensocial-0.8″ />

</ModulePrefs>

<Content type=”html”>

<!–[CDATA[-->

<script type="text/javascript">

function doSomething() {

// do something

// call social data like firends/activities/app data and display in the HTML

}

</script>

<input type="button" value="Say hello" onclick="doSomething(); return false;"/>

<h1>Hello, world!</h1>

]]>

</Content>

</Module>

OpenSocial API are purely based on existing standards (XML/HTML/JavaScript). You don’t need to learn any new mark up language like FBML (mark-up language for creating Facebook apps). You can find the a list of tutorials and articles on writing OpenSocial applications here (http://wiki.opensocial.org/index.php?title=Articles_%26_Tutorials)

For the Social Network Sites/application, they all just need to implement the required API to full fill the specified requests from the applications like Friends or Activities. There is a sample implementation for social networks available on Apache Software Foundation named as ‘Shindig’ (http://shindig.apache.org/) . Most of the live containers are based on this implementation only.

OpenSocial has its own benefits and it has created new business aspects for the web-based social networking sites. They can now build/launch cool application and engage their users for long-term. Application developers can also get paid by several means like embedding ads, payments from social networks & they can reach a huge amount of users without creating their own community to showcase their cools applications. Although there are quite a few anxiety about privacy & security of data but OpenSocial specification has dealt with all the concerns very carefully. List of OpenSocial supported sites(http://www.opensocial.org/) proves that OpenSocial is going for a long way ahead. Some people has also suspected the role of Google in OpenSocial development but to sustain the free and open development of OpenSocial specifications a non-profit corporation ‘OpenSocial Foundation’ (http://www.opensocial.org/page/opensocial-foundation) has been created.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.