Developer news
Platform Updates: Operation Developer Love

This week, we removed the App Directory (in its current form) since it does not drive a significant amount of traffic to your apps and released a simplified way of getting your app into the Facebook search index. We also finished rolling out the new Dev App to all developers.

New Functionality for Managing Pages through the Graph API

This week, we updated the Graph API Pages object to make it easier to manage your Pages. You can now retrieve access tokens, manage a Page’s wall settings, and install app tabs directly from the API.

Retrieving access tokens for a Page
If you manage many Pages, it can be cumbersome to retrieve access tokens via the /me/accounts connection. Now, you can get the admin access token for a Page by requesting the access_token field on the Page itself:

https://graph.facebook.com/PAGE_ID
  ?fields=access_token&access_token=ACCESS_TOKEN

This request will return a Page token in the access_token field of the response. Note that the access_token field is a non-default field and must be requested explicitly via the fields URL parameter. In addition, you must use a user access_token with the manage_pages permission to make this request, where the user is an administrator of the Page.

Retrieving and updating the Wall settings for a Page
With the Page access token from above, you can retrieve the wall settings for your Page using the /settings connection on the Page. For example:

<?php
$app_id = "MY_APP_ID";
$app_secret = "MY_APP_SECRET";
$my_url = "MY_APP_URL";
$page_id = "PAGE_ID_OF_PAGE_TO_MANAGE";

$code = $_REQUEST["code"];

echo '<html><body>';

if(empty($code)) {
  // Get permission from the user to manage their Page. 
  $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
    . $app_id . "&redirect_uri=" . urlencode($my_url)
    . "&scope=manage_pages";
  echo('<script>top.location.href="' . $dialog_url . '";</script>');
} else {

   // Get access token for the app, so we can GET Page access token
  $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
      . $app_id . "&redirect_uri=" . urlencode($my_url)
      . "&client_secret=" . $app_secret
      . "&code=" . $code;
  $access_token = file_get_contents($token_url);

  $page_token_url = "https://graph.facebook.com/" .
    $page_id . "?fields=access_token&" . $access_token;
  $response = file_get_contents($page_token_url);

  // Parse the return value and get the Page access token
  $resp_obj = json_decode($response,true);
  
  $page_access_token = $resp_obj['access_token'];
  
  // Using the Page access token from above,
  // we can GET the settings for the page
  $page_settings_url = "https://graph.facebook.com/" .
    $page_id . "/settings?access_token=" . $page_access_token;
  $response = file_get_contents($page_settings_url);
  $resp_obj = json_decode($response,true);
  
  echo '<pre>';
  print_r($response);
  echo '</pre>';
 
}

echo '</body></html>';
?>

This will return results similar to the following, indicating the current setting for the Page’s wall:

{
  data: [
    {
      setting: "USERS_CAN_POST",
      value: true,
    },
    {
      setting: "USERS_CAN_POST_PHOTOS",
      value: true,
    },
    {
      setting: "USERS_CAN_TAG_PHOTOS",
      value: false,
    },
    {
      setting: "USERS_CAN_POST_VIDEOS",
      value: true,
    },
  ]
}

You can update the wall settings for your Page by issuing an HTTP POST to PAGE_ID/settings with the ‘setting’ (note, there’s no ‘s’ at the end) and ‘value’ parameters. For example:

https://graph.facebook.com/PAGE_ID/settings?setting=USERS_CAN_POST_PHOTOS
  &value=true&method=POST&access_token=PAGE_ACCESS_TOKEN

See the documentation for the Page object for all the available options for wall settings.

The Graph API Explorer makes it easy to read and update your Page settings interactively. If you get a ‘subject must be a Page’ error, you are likely not using the Page access token for the request.

Installing App Tabs for a Page
You can now read, install and manage app tabs for a Page via the /tabs connection. You no longer have to log in to the UI to install an app across multiple Pages. To read the current tabs for a Page, issue an HTTP GET to PAGE_ID/tabs using the Page access token from above:

https://graph.facebook.com/PAGE_ID/tabs
  ?access_token=PAGE_ACCESS_TOKEN

To install a profile tab at the end of the current list of tabs, issue an HTTP POST to PAGE_ID/tabs with the app_id of the app you want to install and the Page access token (as described above):

https://graph.facebook.com/PAGE_ID/tabs?app_id=APP_ID&method=POST
  &access_token=PAGE_ACCESS_TOKEN

See the updated doc complete details about these new capabilities on the Graph API Page object.

Ref param on Send Button

We made available a new attribute to the Send Button that lets you track referrals back from Facebook. The ref attribute causes two parameters to be added to the referrer URL when a user clicks a link from a Send action:

  • fb_ref - the ref parameter
  • fb_source - the story type (‘message’, ‘group’, ‘email’) in which the click occurred.

Below is an example of adding a ref parameter to the Send Button:

<html><body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:send href="YOUR_SITE_URL"></fb:send>
</body></html>

When a user clicks a link back to your website, we will pass an fb_ref value as well as a fb_ref parameter in the referrer URL:

http://www.yoursite.com/home?fb_ref=top_left&fb_source=message


For more information, please visit our Send Button documentation.

Graph API Explorer can now be used with any Test user

Developers can now log in as test users of their apps to explore the graph with the Graph API Explorer. This is in response to the significant feedback we received from developers when we launched the Explorer. Being able to log in as a test user when using the Graph API Explorer allows developers to test posting content freely without having to worry about posts showing up on their user profile or in their friends’ News Feed.

Optimizing payment methods for users

This week we rolled out an improvement to reorder payment options based on the user's country. This will simplify the payment process and increase conversion. For example, mobile payments are used more frequently in Turkey than credit cards, so when a Turkish user enters the Facebook credits purchasing flow, she will be presented with mobile options towards the top of their list. However, in the US market where mobile is less frequently used, it will be presented lower on the list and PayPal and credit cards will be surfaced at the top. This change has been rolled out to all credit purchase flows on Facebook and does not require any code changes.

Documentation Activity for the Last Seven Days

We have updated the FQL documentation:

116 docs are under review.

Fixing Bugs

Bugzilla activity for the past 7 days:

  • 156 new bugs were reported
  • 41 bugs were reproducible and accepted (after duplicates removed)
  • 12 bugs were fixed (10 previously reported bugs and 2 new bugs)
  • As of today, there are 1,370 open bugs in Bugzilla (down 63 from last week)

Forum Activity

Forum activity for the past 7 days:

  • 551 New Topics Created
  • 223 New Topics received a reply
  • 40% received a reply from a community moderator or a Facebook employee