This week, we published the following updates:
hideFlashCallback
function from being called when passed into FB.init. This has now been fixed, and the functionality restored.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>'; ?>
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 activity for this week:
Activity on facebook.stackoverflow.com this week: