Online Book Reader

Home Category

Facebook Cookbook - Jay Goldman [139]

By Root 725 0

HTTP code 400s—Bad Request

canvas_page_views_http_code_401

HTTP code 401s—Unauthorized

canvas_page_views_http_code_403

HTTP code 403s—Forbidden

canvas_page_views_http_code_404

HTTP code 404s—Not Found

canvas_page_views_http_code_405

HTTP code 405s—Method Not Allowed

canvas_page_views_http_code_413

HTTP code 413s—Request Entity Too Large

canvas_page_views_http_code_422

HTTP code 422s—Unprocessable Entity

canvas_page_views_http_code_500

HTTP code 500s—Internal Server Error

canvas_page_views_http_code_502

HTTP code 502s—Bad Gateway

canvas_page_views_http_code_503

HTTP code 503s—Service Unavailable

canvas_page_views_http_code_505

HTTP code 505s—HTTP Version Not Supported

FQL equivalent


If you’d prefer to use FQL to access your metrics, the equivalent query is:

SELECT active_users, canvas_page_views FROM metrics WHERE end_time

= 1206946800 AND period = 86400

For more information, see Metrics Table.

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, so treat them with a little caution and make sure to report any bugs you might find to the Facebook Bug Tracker, at http://bugs.developers.facebook.com.

The list of properties you can specify in either method is pretty extensive and covers basically anything that you set in the Developer app (see Table 9-5, but for the most up-to-date list, refer to http://wiki.developers.facebook.com/index.php/ApplicationProperties).

Table 9-5. Application properties

Property

Type

Description

application_name

string

Name of your application.

callback_url

s tring

Callback URL, which can’t be longer than 100 characters and will be off-Facebook on your server.

post_install_url

string

URL where a user gets redirected after installing your app. Can’t be longer than 100 characters.

edit_url

string

Appears to be an empty string.

dashboard_url

string

URL to your app’s dashboard (generally the first page in your app, at http://apps.facebook.com/yourapp).

uninstall_url

string

URL where a user gets redirected after removing your application.

ip_list

string

IP addresses of the servers you’ve given permission to access Facebook’s servers. This applies only to web-based apps.

email

string

Email address associated with your app, which Facebook uses to contact you (default value is your Facebook email address).

description

string

Description of your application.

use_iframe

bool

False ( 0) means you use FBML; true (1) means you use an iFrame.

desktop

bool

False ( 0) means a web-based app; true (1) means a desktop app.

Return Main Page Previous Page Next Page

®Online Book Reader