Effective July 1, we will require social game developers on Facebook Platform to process all payments through Facebook Credits, as we announced in January. Any games that are not using Facebook Credits exclusively on July 1st will be subject to enforcement action. For information on implementation options and best practices, please see our Credits Migration page. To learn more or follow the latest news on Facebook Credits, visit the Credits page on the Developer Site.
This week, we announced alternative payment methods for Facebook Credits, in 13 countries in Asia and Latin America. In addition, we’ve developed a new payout process that allows us to support payouts to developers in nearly all countries globally. See the announcement for more details.
This week, we also released a companion to the Send button, the Send Dialog. Like the Send button, the Send Dialog allows users to send content to specific people and groups, and is useful for doing deep integration with Facebook Messages. The Send Dialog resembles the Feed Dialog in implementation. Check out the details in our blog post and in the reference documentation.
We continue to transition from the REST API to the Graph API. In addition to a user’s wall, you can now upload videos directly to a Application, Group, or Page’s wall. The reference documentation for the Video object lists the video formats that are supported.
Uploading a Video to a Group
Posting a video to a Group requires the publish_stream
permission and is accomplished exactly the same way as uploading a video to a user’s wall, with the single exception that you must replace the user (‘me’, the user’s login name, or the USER_ID) in the Graph API URL with the appropriate GROUP_ID:
<?php $app_id = "YOUR_APP_ID"; $app_secret = "YOUR_APP_SECRET"; $my_url = "YOUR_POST_LOGIN_URL"; $video_title = "TITLE FOR THE VIDEO"; $video_desc = "DESCRIPTION FOR THE VIDEO"; $group_id = "YOUR_GROUP_ID"; $code = $_REQUEST["code"]; echo '<html><body>'; if(empty($code)) { $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&scope=publish_stream"; 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; $access_token = file_get_contents($token_url); $post_url = "https://graph-video.facebook.com/" . $group_id . "/videos?" . "title=" . $video_title. "&description=" . $video_desc . "&". $access_token; echo '<form enctype="multipart/form-data" action=" '.$post_url.' " method="POST">'; echo 'Please choose a file:'; echo '<input name="file" type="file">'; echo '<input type="submit" value="Upload" />'; echo '</form>'; echo '</body></html>'; ?>
<br/>
When the upload completes, the VIDEO_ID of the new Video
object will be returned.
<br/>
Uploading a Video to an Application or Page
Uploading a video to an Application or Page is similar to uploading to a User or Group’s wall, but you must use an access token specifically for the Application or Page to which you want to upload the video. To get this access token, you request the manage_pages
permission (in addition to publish_stream
) and then get the access token for the account (Application or Page). To do this, issue an HTTP GET to /USER_ID/accounts. This will return an array of objects containing id, name, category, and access_token fields for each Application or Page the user has access to. You can then use the appropriate access token from this list to perform the upload using the same method as above:
<?php $app_id = "YOUR_APP_ID"; $app_secret = "YOUR_APP_SECRET"; $my_url = "YOUR_POST_LOGIN_URL"; $video_title = "TITLE FOR THE VIDEO"; $video_desc = "DESCRIPTION FOR THE VIDEO"; $page_id = "YOUR_PAGE_ID"; // Set this to your APP_ID for Applications $code = $_REQUEST["code"]; echo '<html><body>'; if(empty($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=publish_stream,manage_pages"; echo('<script>top.location.href="' . $dialog_url . '";</script>'); } else { // Get access token for the user, so we can GET /me/accounts $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); $accounts_url = "https://graph.facebook.com/me/accounts?" . $access_token; $response = file_get_contents($accounts_url); // Parse the return value and get the array of accounts we have // access to. This is returned in the data[] array. $resp_obj = json_decode($response,true); $accounts = $resp_obj['data']; // Find the access token for the page to which we want to post the video. foreach($accounts as $account) { if($account['id'] == $page_id) { $access_token = $account['access_token']; break; } } // Using the page access token from above, create the POST action // that our form will use to upload the video. $post_url = "https://graph-video.facebook.com/" . $page_id . "/videos?" . "title=" . $video_title. "&description=" . $video_desc . "&access_token=". $access_token; // Create a simple form echo '<form enctype="multipart/form-data" action=" '.$post_url.' " method="POST">'; echo 'Please choose a file:'; echo '<input name="file" type="file">'; echo '<input type="submit" value="Upload" />'; echo '</form>'; } echo '</body></html>'; ?>
<br/>
As above, when the upload completes, the VIDEO_ID of the new Video
object will be returned.
<br/>
<br/>
NOTE: It may take several minutes for uploaded videos to be visible on the Application, Page or Group’s wall.
<br/><br/>
Documentation activity for the past 7 days
We updated the Graph API docs for the <br/><br/>
Fixing Bugs
Bugzilla activity for the past 7 days:
Forum Activity
Developer Forum activity for the past 7 days:
Fran Larkin, who works in product marketing, just uploaded a video using the Graph API