How to use Facebook's Open Graph API to program the Web

Facebook's highly innovative use of open APIs is proving very influential in Web application design. The company introduced a new API that will allow any page on the Internet to be managed like a Facebook fan page. The Open Graph API should make it easier to collect and manage data into the Facebook social graph.

The Facebook website and its highly innovative use of open APIs is proving very influential in Web application

design. Recently, Facebook replaced its Facebook Connection API with a new interface that will allow any page on the Internet to be managed like a Facebook fan page. This change promises to make it easier to collect and manage data in the Facebook social graph for more applications.

The social graph is a relatively new kind of database that drives social networks. It consists of piles of ephemeral data which, in and of themselves, are relatively meaningless. Facebook and its partners can programmatically tap into this database to create myriad site capabilities – to, in effect, program the Web.

The Upgrades

The main Facebook API upgrades announced earlier this year by CTO Brett Taylor include social plugins, the Open Graph Protocol, and the Graph API. These changes promise to further consolidate Facebook's lock on the largest social graph in operation. Taylor noted that "the Web is moving to a model based on the connections between people and all of the things they care about." The improvements promise to help the process of growing the underlying graph of connections in a way that is both interoperable and easy to use.

Social plugins allow website developers to add Facebook widgets using a single line of code. The first five social plugins include a like button, activity stream, recommendations, Facebook login, and a social bar. These promise to simplify the incorporation of Facebook features to a website. For example, the movie database site IMDb.com uses the like button plugin to share movie ratings among friends. Full details on the different Facebook social plugins are available.

The Open Graph Protocol allows content to be linked across users, different parts of their profiles, and their activity streams. It is implemented by adding a special page header and a social plugin. This feature could make it easy for consumers to add a movie, book, or baseball team to their list of favorites on Facebook. The publisher can use this infrastructure to push out updates, such as the latest scores.

The Graph API is the final piece of the overhaul. It is a redesign of the core Facebook API, which allows any object to be addressed via a URL. For example, the process of referring to an individual graph shrinks from several lines of codes to: https://graph.facebook.com/btaylor. This makes it possible to search over objects and personalized stream updates for a user.

Helpful Graph API Resources:

A variety of resources have sprung up to help developers get the most out of Facebook related projects. The best place to start is the Facebook developer's page.

Think Different, a blog by Mahmud Ahsan, has a variety of Facebook development tips. His collection covers things like retrieving the time period of a stream, programmatically comparing friend's lists, and increasing Facebook iframe application performance.

The Apigee Facebook API console helps simplify the Graph API programming process. It allows developers to learn, debug, interact with and develop applications by using the API to trace through the various connections and links in the social graph.

Thierry Schellenbach has written about implementing the new Open Graph APIs on top of Django.

This was first published in July 2010

Dig deeper on Representational State Transfer (REST)

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close