This week, we published the next steps on the OAuth 2.0 and HTTPS migration and launched new Page Insights.

Getting and Setting App Restrictions using the Graph API

Some apps require demographic restrictions (i.e., location, age, age distribution, type). Now, you can restrict access to your app to a specific set of users by issuing an HTTP POST with an app access token to:

https://graph.facebook.com/APP_ID?restrictions={“RESTRICTION_TYPE:VALUE”, …}

Specify the RESTRICTION_TYPE and VALUE. If successful, the response will evaluate to true.

To retrieve your app restrictions, issue an HTTP GET with an app access token to:

https://graph.facebook.com/APP_ID?fields=restrictions

Sample response:

{
  "restrictions":
    {
      "location":"US"
    },
  "id":"292980804060689"
}

Full PHP example below that restricts an app to the US and reads back the restriction:

<?php
  $app_id = 'YOUR_APP_ID';
  $app_secret = 'YOUR_APP_SECRET';

  // Get an App Access Token
  $app_token_url = 'https://graph.facebook.com/oauth/access_token?'
    . 'client_id=' . $app_id
    . '&client_secret=' . $app_secret
    . '&grant_type=client_credentials';

  $app_access_token = file_get_contents($app_token_url);
 
  // Set app restrictions
  $set_url = 'https://graph.facebook.com/'
    . $app_id . '?restrictions={"location":"US"}'
    . "&method=post&" . $app_access_token;

   $set_result = file_get_contents($set_url);

  echo '<pre>';
  echo 'Set result: ' . $set_result . '<br />';
  echo '</pre>';

  // Get app restrictions list
  $restrictions_url = 'https://graph.facebook.com/'
    . $app_id . '?fields=restrictions&'
    . $app_access_token;

  $restrictions_result = file_get_contents($restrictions_url);
  $restrictions_obj = json_decode($restrictions_result, true);

  echo '<pre>';
  print_r($restrictions_obj);
  echo '</pre>';

?>

This information is also easily retrieved from the application FQL table:

SELECT restriction_info FROM application WHERE app_id=YOUR_APP_ID

Sample response:

[
  {
    "restriction_info":{"location":"US"}
  }
]

For more information, please refer to documentation on the application Graph API object and FQL table.

90-day migration due February 1, 2012: Use game:points instead of og:points

The Open Graph meta tag property og:points is being renamed to game:points to be more consistent with game.achievement og:type. Please migrate to use game:points instead of og:points. Both properties will continue to work until February 1st when og:points will stop working.

f8 comes to Asia, Europe, and more US locations

Post-f8, we began hosting developer events in Seoul and Singapore to help developers integrate with the Open Graph. Thank you to all who attended these events and made them successful. Our team will soon be visiting Tokyo, Europe, and other US locations later this month.

Bugs

A couple of weeks ago, we introduced a new bugs tool. In the past week in the new bugs tools there were:

  • 239 bugs reported
  • 21 bugs accepted
  • 2 bugs fixed

Although no new bugs can be filed in Bugzilla, we will continue working on closing out the remaining open bugs in Bugzilla. The total number of open bugs in Bugzilla is now 1,260 (down 121 from last week).

Facebook Stack Overflow activity

Activity on facebook.stackoverflow.com this week:

  • 402 questions asked
  • 98 answered, 24% answered rate
  • 218 replied, 54% reply rate