This week, we updated the JavaScript SDK to support OAuth 2.0 and extended the timeline for apps to migrate to OAuth 2.0 by October 1st.

Dark background for the Facepile plugin

Similiar to other social plugins, the Facepile plugin is now also available in the dark color scheme.

You can preview Facepile in the dark background by toggling the 'color scheme' field to 'dark' in the Facepile configurator.

<br/> <br/>

Uploading Photos to the Graph API via a URL

Earlier this year, we released support for uploading photos directly via the Graph API. This requires sending the photo as a MIME-encoded form field. We are now enhancing our photo upload capability by introducing the ability to upload photos simply by providing a URL to the image. This simplifies photo management for a number of use cases:

  • App developers who host their images on Amazon S3 or a similar service can pass the S3 URL directly to Facebook without having to download the file to their application servers only to upload it again to Facebook. This improves performance and reduces costs for developers.
  • Apps written on platforms that don't have good support for multipart file uploads can create new photos more easily.

To upload a photo via a URL, simply issue an HTTP POST to ALBUM_ID/photos with the url field set to the URL of the photo you wish to upload. You need the publish_stream permission to perform this operation. You can also include an optional message parameter to set a caption for the photo. For example:

<?php
  $app_id = "APP_ID";
  $app_secret = "APP_SECRET";
  $post_login_url = "POST_AUTH_REDIRECT_URL";
  $album_id = "ALBUM_ID";
  $photo_url = "PHOTO_URL";
  $photo_caption = "PHOTO_CAPTION";

  $code = $_REQUEST["code"];

  //Obtain the access_token with publish_stream permission 
  if (!$code){ 
    $dialog_url= "http://www.facebook.com/dialog/oauth?"
      . "client_id=" .  $app_id
      . "&redirect_uri=" . urlencode( $post_login_url)
      .  "&scope=publish_stream";
    echo("<script>top.location.href='" . $dialog_url
      . "'</script>");
  } else {
    $token_url="https://graph.facebook.com/oauth/access_token?"
      . "client_id=" . $app_id
      . "&client_secret=" . $app_secret
      . "&redirect_uri=" . urlencode( $post_login_url)
      . "&code=" . $code;
    $response = file_get_contents($token_url);
    $params = null;
    parse_str($response, $params);
    $access_token = $params['access_token'];

    // POST to Graph API endpoint to upload photos
    $graph_url= "https://graph.facebook.com/" 
      . $album_id . "/photos?"
      . "url=" . urlencode($photo_url)
      . "&message=" . urlencode($photo_caption)
      . "&method=POST"
      . "&access_token=" .$access_token;

    echo '<html><body>';
    echo file_get_contents($graph_url);
    echo '</body></html>';
  }
?>

The HTTP POST may take some time to complete, depending on picture size, network availability, etc.

Attaching Existing Facebook Photos to Wall Posts

This week we released the ability to attach existing Facebook photos from a user’s album to new posts on their Wall. To do this, issue an HTTP POST to USER_ID/feed with the Post object parameters. Include an object_attachment parameter which specifies the photo ID of the photo you wish to attach to the post. The User must be the owner of the photo, and the photo cannot be part of a message attachment.

For example:

<?php
  $app_id = "APP_ID";
  $app_secret = "APP_SECRET";
  $post_login_url = "POST_AUTH_REDIRECT_URL";
  $photo_id = "PHOTO_ID";
  $wall_message = "MESSAGE_FOR_POST";
  $wall_link = "LINK_TO_POST";
  $user_id = "USER_ID";

  $code = $_REQUEST["code"];

  // Obtain the access_token with publish_stream permission 
  if (!$code) {
    $dialog_url= "http://www.facebook.com/dialog/oauth?"
      . "client_id=" .  $app_id
      . "&redirect_uri=" . urlencode( $post_login_url)
      .  "&scope=publish_stream";
    echo("<script>top.location.href='" . $dialog_url
      . "'</script>");
  } else {
    $token_url="https://graph.facebook.com/oauth/access_token?"
      . "client_id=" . $app_id
      . "&redirect_uri=" . urlencode( $post_login_url)
      . "&client_secret=" . $app_secret
      . "&code=" . $code;
    $response = file_get_contents($token_url);
    $params = null;
    parse_str($response, $params);
    $access_token = $params['access_token'];

    // POST to Graph API feed endpoint, which is the user's Wall
    $graph_url= "https://graph.facebook.com/" . $user_id . "/feed?"
      . "message=" . urlencode($wall_message)
      . "&link=" . urlencode($wall_link)
      . "&object_attachment=" . $photo_id
      . "&method=POST"
      . "&access_token=" .$access_token;

    echo '<html><body>';
    echo file_get_contents($graph_url);
    echo '</body></html>';
  }
?>

See the /posts connection on the Graph API User object for further details.

Documentation Activity for the Last Seven Days

We have updated the FQL documentation for the following tables:

103 docs are under review

Fixing Bugs

Bugzilla activity for the past 7 days:

  • 201 new bugs were reported
  • 71 bugs were reproducible and accepted (after duplicates removed)
  • 20 bugs were fixed (16 previously reported bugs and 4 new bugs)
  • As of today, there are 1,288 open bugs in Bugzilla (down 82 from last week)

Forum Activity

Developer Forum activity for the past 7 days:

  • 442 New Topics Created
  • 176 New Topics received a reply
  • 13% received a reply from a community moderator or a Facebook employee