NAME

Facebook::Graph - A fast and easy way to integrate your apps with Facebook.

VERSION

version 1.1205

NOTICE OF DEPRECATION

Facebook::Graph brought the world of Facebook to Perl, but as Facebook is massively changing their APIs it is impossible to keep up with a heavy weight module like Facebook::Graph. Instead, we recommend switching to the lighter weight Facebook::OpenGraph module. We won't be removing Facebook::Graph from CPAN, but we won't be adding new features to keep up with all of Facebook's constant changes either.

DESCRIPTION

This is a Perl interface to the Facebook Graph API http://developers.facebook.com/docs/api. With this module you can currently query public Facebook data, query privileged Facebook data, and build a privileged Facebook application. See the TODO for all that this module cannot yet do.

WARNING: The work on this module has only just begun because the Graph API itself isn't very new, and I'm only working on it as I have some tuits. Therefore things are potentially subject to change drastically with each release.

METHODS

new ( [ params ] )

The constructor.

params

A hash of base parameters, just so you don't have to pass them around. If you only want to do public queries then these params are not needed.

access_token

An access token string used to make Facebook requests as a privileged user. Required if you want to make privileged queries or perform privileged actions on Facebook objects.

app_id

The application id that you get from Facebook after registering (http://developers.facebook.com/setup/) your application on their site. Required if you'll be calling the request_access_token, convert_sessions, or authorize methods.

secret

The application secret that you get from Facebook after registering your application. Required if you'll be calling the request_access_token or convert_sessions methods.

postback

The URI that Facebook should post your authorization code back to. Required if you'll be calling the request_access_token or authorize methods.

NOTE: It must be a sub URI of the URI that you put in the Application Settings > Connect > Connect URL field of your application's profile on Facebook.

authorize ( )

request_access_token ( code )

Creates a Facebook::Graph::AccessToken object and fetches an access token from Facebook, which will allow everything you do with Facebook::Graph to work within user privileges rather than through the public interface. Returns a Facebook::Graph::AccessToken::Response object, and also sets the access_token property in the Facebook::Graph object.

request_extended_access_token ( access_token )

Note: access_token is optional. Creates a Facebook::Graph::AccessToken object and fetches an (https://developers.facebook.com/docs/facebook-login/access-tokens/#extending) extended access token from Facebook. This method accepts an optional access token. If you have called request_access_token already on the Facebook::Graph object and access_token is set, then you do not have to pass in an access token. However, if you have an access token stored from a previous object, you will need to pass it in.

code

An authorization code string that you should have gotten by going through the authorize process.

$signed_request

A signature string passed from Facebook. To capture a signed request your app must be displayed within the Facebook canvas page and then you must pull the query parameter called signed_request from the query string.

EXCEPTIONS

This module throws exceptions when it encounters a problem. It uses Ouch to throw the exception, and the Exception typically takes 3 parts: code, message, and a data portion that is the URI that was originally requested. For example:

If you were using any version of Facebook::Graph before 1.1000, then you may be used to doing things like creating events through this API, or using a person's username instead of their ID, or making queries without an access token. You can't do any of those things anymore, because as of the Facebook Graph v2.0 API, none of them is supported any longer.

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.