Actualités des développeurs
Platform Updates: Operation Developer Love

This week, we published the following updates:

  • Test users on Open Graph apps are now enabled for Timeline.
  • If you create test accounts, the default birthday is "8/8/1990" so if a test user gets blocked at login it is possible to unblock them.
  • As mentioned previously, there was a bug that prevented the hideFlashCallback function from being called when passed into FB.init. This has now been fixed, and the functionality restored.
  • Canvas apps should not function principally to redirect users outside of the Facebook experience to an external site. There are security issues with supporting this. We have implemented a technical solution to detect this in many cases.
  • Queries for the user’s name on the FQL user table observe the locale setting and return the localized name based on the locale of the calling user.

Friend Request Summary via Graph API

As part of our deprecation of the REST APIs we now have implemented in the Graph API the ability to obtain summary information about friends requests that was previously available in the notifications.get REST API method. The /USER_ID/friendrequests connection now includes a new field called summary that includes total_count, unread_count and last updated_time of this data. This can be used to simulate notification counts similar to the Facebook "jewels" (the friend request, messages, and notification icons next to the Facebook logo when you log in to facebook.com).

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

$code = $_REQUEST["code"];

echo '<html><body>';

if(!$code) {
    // Get permission from the user to publish to their page.
    $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
     . $app_id . "&redirect_uri=" . urlencode($my_url)
     . "&scope=read_requests";
    echo('<script>top.location.href="' . $dialog_url . '";</script>');
} else {
    // Get access token for the user
    $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);
    $friendrequests = "https://graph.facebook.com/me/friendrequests?"
     . $access_token;
    $response = file_get_contents($friendrequests);

    echo '<pre>';
    print_r(json_decode($response));
    echo '</pre>';
}
echo '</body></html>';
?>

Getting Questions via the Graph API

This week, we released a new Graph API endpoint to let you query questions that users have asked, along with the responses the questions have received. To do this, issue an HTTP GET request to the /USER_ID/questions endpoint with the user_questions or friends_questions permissions.

Calling this API will return Questions asked by the user, along with an array of QuestionOption objects representing each of the options available as answers to the questions. Each QuestionOption object will also contain a tally of votes received for that option.

You can retrieve the options for a specific question by issuing an HTTP GET request to /QUESTION_ID/options. In addition, you can enumerate the users that have voted for a specific option by issuing an HTTP GET to /QUESTION_OPTION_ID/votes. This will return an array of objects containing id and name fields for each user that has voted for that option.

The following is an example of how to get the current questions a user has asked.

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

$code = $_REQUEST["code"];

echo '<html><body>';

if(!$code) {
    // Get permission from the user to publish to their page.
    $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
     . $app_id . "&redirect_uri=" . urlencode($my_url)
     . "&scope=user_questions,friends_questions";
    echo('<script>top.location.href="' . $dialog_url . '";</script>');
} else {
    // Get access token for the user
    $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);
    $questions = "https://graph.facebook.com/me/questions?"
     . $access_token;
    $response = file_get_contents($questions);

    echo '<pre>';
    print_r(json_decode($response));
    echo '</pre>';
}
echo '</body></html>';
?>

You can also query the question, question_option and question_option_votes FQL tables for questions and associated details.

Bugs

Bugs activity for this week:

  • 261 bugs reported
  • 44 bugs accepted
  • 6 bugs fixed

Facebook Stack Overflow activity

Activity on facebook.stackoverflow.com this week:

  • 362 questions asked
  • 110 answered, 30% answered rate
  • 191 replied, 53% reply rate