RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


OpenSocial: The Power of Social Networks in Your Applications

What is OpenSocial and how can you use it to build web applications that leverage the power of social networks? Find out while going from a basic example application in a local sandbox to a full-featured application deployed in a live container.

penSocial, a set of application programming interfaces (APIs) based on standard HTML and JavaScript, simplifies the creation of web-based applications that interact with social networks. Launched by Google in November 2007, the OpenSocial APIs are supported (or in the process of being adopted) by a number of different social networks, such as orkut, MySpace, Yahoo! , hi5, and Friendster. Thanks to such broad support, a developer has to learn the APIs only once to be able to contribute applications to all these different social networks. Through OpenSocial, you will be able to interact seamlessly with your orkut communities and friends, write applications that leverage your shared interests with your friends on MySpace, and so on.

This article will guide you through the OpenSocial APIs and show you how to build a couple of social applications to share interests with friends. Figure 1 and Figure 2 show the final results: two applications, loaded within the orkut container to share travel experiences and movie preferences with a network of friends.

Figure 1. A Travel-Sharing Application Embedded Within orkut: This application is loaded within the orkut container to share travel experiences.
Figure 2. A Movie Preferences-Sharing Application Embedded Within orkut: This application is loaded within the orkut container to share movie preferences.

Introduction to Social Networks and OpenSocial
A social network is an ensemble of users who are linked to each other through a series of relationships (being friendly, being work colleagues, sharing common interests). Each user is characterized by a state or profile, which is a collection of all the variables required to describe the user fully, such as name, gender, hobbies, work, or contact information. Each user also has a series of relationships that link him to his own friends on the network. Some networks also support the concept of activities: streams of actions performed by the user within the network that alter his state or the set of his relationships with other people.

The OpenSocial APIs provide access to all these entities and are divided into the following major components, each responsible for a specific task:

  • People and relationships: for accessing information on the user who is interacting with the application, his profile, and his relationships on the network
  • Persistence: for manipulating the user state or profile and saving and loading additional information related to the user and required by the application
  • Activities: for interacting with the user's activities stream, publishing new activities performed by the user, or listening to events that occurred to the user's friends

A typical OpenSocial application is built completely using HTML to lay out and display information and JavaScript to define the application logic. OpenSocial applications are built on top of the Google Gadgets APIs. For this reason, an OpenSocial application looks and behaves just like a Google Gadget. To learn more about Google Gadgets, read this introductory article published on DevX or the official documentation.

Author's Note: The content is exclusively the personal opinion of the author. Under no circumstances should the content be attributed to any employer, past, present, or future, of the author, unless so stated explicitly by that individual or organization.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date