O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Started with the Client Library

Problem

OK! I’m down with the API scene. How do I get started?

Solution

You need to download a Facebook Client Library in the language of your choice, get it installed on your server, and then get cracking! You’ll find links to various Client Libraries at http://developers.facebook.com/get_started.php, but keep in mind that the only officially supported version is the PHP 4/5 library, and so using another language means relying on third parties to keep the library up-to-date.

In addition to the Wiki (http://wiki.developers.facebook.com/index.php/API), there’s some documentation for the Client Library in the actual code files in the form of comments, and it’s often easier to figure out how to use a function by just looking it up in the facebookapi_php5_restlib.php file than trying to find it on the Web.

Discussion

If you’re running PHP, this should be as simple as downloading the library from Facebook, uploading to your server, and creating a config.php file with your app’s API and secret keys. The PHP Client Library comes with the Footprints sample application, which will give you a very simple overview of an app that uses the API to set some Profile Actions and Boxes. There are also two more demo apps, Restaurants and Who’s Showing Up, which show off Mock Ajax, FBJS, and the Data Store API, and the ability to build apps for users and Pages, respectively. You can find all three apps at http://wiki.developers.facebook.com/index.php/Demos.

If you’re ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required