Skip to Main Content
Facebook Cookbook
book

Facebook Cookbook

by Jay Goldman
October 2008
Intermediate to advanced content levelIntermediate to advanced
434 pages
12h 7m
English
O'Reilly Media, Inc.
Content preview from Facebook Cookbook

Getting and Setting Application Properties

Problem

I need to retrieve or set some of the properties about my application.

Solution

Use the Admin.getAppProperties() method to retrieve properties:

$targetProps = array('application_name','description');
$properties = $facebook->api_client->admin_getAppProperties($targetProps);

Use the Admin.setAppProperties() method to set properties:

$setProps = array('description' => 'My new description!');
$return = $facebook->api_client->admin_setAppProperties($setProps);

Discussion

Admin.getAppProperties() returns an array, with each named element being one of the properties you requested. In addition to whatever you ask for, Facebook will always return your app’s canvasname, icon_url, and logo_url appended to the end of the returned array.

Admin.setAppPropoerties() will return a code indicating whether it worked. Confusingly, it returns true as the value 1 if it works, which coincides with error code 1, which signifies an unknown error (see Batching Calls). If you’re concerned it’s not working, you can do a check using Admin.getAppPropoerties():

$setProps = array('description' => 'This was set using the new
 Admin.setAppProperties() method!');
$return = $facebook->api_client->admin_setAppProperties($setProps);

$getProps = array('description');
$newDesc = $facebook->api_client->admin_getAppProperties($getProps);

if($newDesc['description'] == $setProps['description']){
    echo 'Success!';
}

Note

These methods are currently marked as beta in the Developers Wiki, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning PHP 5.3

Beginning PHP 5.3

Matt Doyle
HTML5 Geolocation

HTML5 Geolocation

Anthony T. Holdener

Publisher Resources

ISBN: 9780596156695Errata