facebook.request()

Type Function
Library facebook.*
Return value event
Revision Current Public Release (2014.2393)
Keywords facebook
See also Implementing Facebook
event.response
event.isError

Overview

Get or post data to the logged-in Facebook account. Can be used to post messages and photos to the account and friends' accounts. Can also be used to get user data and recent posts.

The request comes back in the form of a fbconnect event that is sent to a listener. This listener was registered during the call to facebook.login().

Syntax

facebook.request( path [, httpMethod, params] )
path (required)

String. The Facebook Graph API path, for example "me", "me/friends", or "me/feed".

httpMethod (optional)

String. "GET" or "POST". If not specified, defaults to "GET".

params (optional)

Table. Table of key/value pairs passed as arguments to the Facebook API call. For more information, see this document.

The following could be used to post a message to the user's account:

facebook.request( "me/feed", "POST", { message="Hello Facebook" } )

Gotchas

Please see the Implementing Facebook guide for important iOS and Android-specific notes.

Example

Please see the Implementing Facebook guide for code examples and usage details.