Developer news
Platform Updates: Operation Developer Love

This week we launched the ability for developers signing up for Facebook Credits to have the option to use PayPal as a payout option.

Breaking change: Graph API PROFILE_ID/feed and PROFILE_ID/posts requires access_token

The Graph API PROFILE_ID/feed/ for a Page, Application, User or Group and PROFILE_ID/posts for a Page or User will now require a vaild access_token to access the wall or posts of the corresponding object (where previously no access_token was required). This will also affect direct FQL queries to the stream table, when querying for posts on a wall.

You will need to pass a valid app or user access_token to access this functionality. Please update your code if you are calling this API without an access token. This change will go live a week from today - Friday(June 3rd). We have updated the Roadmap to reflect this change.

Moving forward, you should always pass a valid app or user access_token with all API requests.

Graph API to Tag photos

As part of our effort to bring the Graph API up to parity with REST this week we added support for reading, writing and updating tags on a photo via Graph API.

  • You can now get tags on a photo by issuing a HTTP GET request to PHOTO_ID/tags.
  • You can create a tag on the photo by issuing an HTTP POST request to the tags connection, PHOTO_ID/tags. You can specify which user to tag using two methods: in the URL path as PHOTO_ID/tags/USER_ID, or in a URL parameter as PHOTO_ID/tags?to=USER_ID with the publish_stream permission.
  • Finally you can update the position of an existing tag for a particular user in the photo by issuing a HTTP POST request to /PHOTO_ID/tags/USER_ID or PHOTO_ID/tags?to=USER_ID with updated x and y coordinates with the publish_stream permission.

Note: This feature is intended to help users tag their friends in real photos. You should not use this feature to encourage users to tag their friends if their friends are not actually in that photo, or to tag friends in composite photos. If your app is find to be encouraging this behavior, your usage of this feature may be disabled. Please see the Photo reference doc for more information.

Here is a code sample that enables you to get a user’s photo, add a new tag to it and then updates the position coordinates of the tag.

<?php 

  $app_id = "YOUR_APP_ID";
  $app_secret = "YOUR_APP_SECRET"; 
  $my_url = "YOUR_POST_LOGIN_URL";

  $friend_to_tag_id= "ID_OF_FRIEND_TO_TAG";
  $x_coordinate = "X_COORDINATE_OF_TAG";
  $y_coordinate = "Y_COORDINATE_OF_TAG";
  $x_new_coordinate = "NEW_X_COORDINATE_OF_TAG";
  $y_new_coordinate = "NEW_Y_COORDINATE_OF_TAG";

  //authentication with publish_stream, user_photo_video_tags permission
  $code = $_REQUEST["code"];
  if(empty($code)) {
    $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
    . $app_id . "&redirect_uri=" . urlencode($my_url) 
    . "&scope=publish_stream,user_photo_video_tags";
    echo("<script>top.location.href='" . $dialog_url . "'</script>");
  }

  $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
    . $app_id . "&redirect_uri=" . urlencode($my_url) 
    . "&client_secret=" . $app_secret 
    . "&code=" . $code;
    $response = file_get_contents($token_url);
    $params = null;
    parse_str($response, $params);
    $access_token = $params['access_token'];
  
  //get the user's photos and photo_id for the first pictre
  $post_url = "https://graph.facebook.com/me/photos?"
  . "access_token=". $access_token;
  $response = file_get_contents($post_url);
  $decoded_response = json_decode($response);
  $photo_id = $decoded_response->data[0]->id;
  

  //Tag friend_to_tag_id at position (x_coordinate, y_coordinate)
  $post_url = "https://graph.facebook.com/"
   .$photo_id . "/tags/" . $friend_to_tag_id 
   . "?access_token=". $access_token
   . "&x=" . $x_coordinate . "&y=" . $y_coordinate . "&method=POST";
  $response = file_get_contents($post_url);
  
  if ($response) 
  {
            //Print the tag we just added
    show_tag_info($photo_id, $friend_to_tag_id, $access_token);

          //Update the x and y coordiates of the user_id
           $post_url = "https://graph.facebook.com/"
           .$photo_id . "/tags/" . $friend_to_tag_id 
           . "?access_token=". $access_token
           . "&x=" . $x_new_coordinate . "&y=" . $y_new_coordinate 
           . "&method=POST";
          $response = file_get_contents($post_url);

           //Print the tag we just updated
     show_tag_info($photo_id,$friend_to_tag_id, $access_token);
   } 

  else echo("errors");

//Function to print the tag information for friend_to_tag_id
  function show_tag_info($photo_id, $friend_to_tag_id, $access_token)
  { 
    //get the tags on the picture
    $post_url = "https://graph.facebook.com/"
    . $photo_id ."/tags?access_token=". $access_token; 
    $response = file_get_contents($post_url);
    $decoded_response = json_decode($response);

 //get the tag for friend_to_tag_id and display its coordinates
    foreach ($decoded_response->data as $tag)
    {
     $user_id = $tag->id;
     if ($user_id==$friend_to_tag_id) break;
    }

    $x = $tag->x;    $y = $tag->y;
    $text= "user id= " . $user_id . " x = ". $x . " y = ".  $y;
    echo ($text . “<br"/>);
 }
?>

Sample result

user id= 499324276 x = 20 y = 30
user id= 499324276 x = 40 y = 50

NOTE: The x and y coordinates in this example are offsets, in percentage, from the left and top edge of the photo, respectively.

Graph API to get user’s video_upload_limits

We also added support to the Graph API where you can now get video_upload_limits for a specific user by issuing a HTTP GET request to USER_ID?fields=video_upload_limits with the appropriate access token.

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

See the User reference doc for more information.

Launching Facebook and Games Page

We are launching the Facebook + Games page similar to our Facebook + media page and Facebook + commerce page to share the latest industry news and best practices for the vertical. Please like the Facebook and Games Page if you wish to stay informed about Facebook Platform games ecosystem and social gaming innovation.

Documentation activity for the past 7 days:

We have been primarily focused on updating Graph API documentation.

Fixing Bugs

Bugzilla activity for the past 7 days:

  • 189 new bugs were reported
  • 32 bugs were reproducible and accepted (after duplicates removed)
  • 7 bugs were fixed (6 previously reported bugs and 1 new bug)
  • As of today, there are 1,353 open bugs in Bugzilla (up 66 from last week)

Forum Activity

Developer Forum activity for the past 7 days:

  • 496 New Topics Created
  • 208 New Topics received a reply
  • 44% received a reply from a community moderator or Facebook employee

Dhiren Patel on the Developer Relations team just tagged himself in a photo via the Graph API.