Kembali ke Beranda untuk Developer

Platform Updates: Operation Developer Love

19 Desember 2013OlehTom Elliott

This week we extended the Facebook Platform on mobile, bringing all the social channels from Facebook on the Web to mobile apps. We also launched new tools to optimize authentication, and we posted a How-To for handling revoked auth permissions.

Finally, we announced the Open Graph Roadshow to help developers get hands-on experience building on technologies we launched at f8. The Roadshow will be coming to Seattle, New York, Chicago and Austin. It's already sold out in all cities except Chicago, where there are only a few seats remaining, so register now to reserve your place.

Graph API for Issuing FQL queries

One of the most common misconceptions we hear from developers is that FQL will be deprecated with the REST API. The reason for this misunderstanding is that, until now, you could only issue FQL queries using the fql.query or fql.multiquery REST API methods. We'd like to reiterate that FQL is here to stay and will not be deprecated in the foreseeable future. In fact, today we are enabling developers to issue FQL queries using the Graph API. With this change, FQL is simply an extension of Graph API.

You can issue an HTTP GET request to https://graph.facebook.com/fql?q=QUERY to run an FQL query. The ‘q’ parameter can be a single FQL query or a multi-query. A multi-query is a JSON-encoded dictionary of queries.

Here is an example that shows how to issue a single FQL query as well as a multi-query with Graph API:

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

    $code = $_REQUEST["code"];

    //auth user
    if(empty($code)) {
    $dialog_url = 'https://www.facebook.com/dialog/oauth?client_id=' 
    . $app_id . '&redirect_uri=' . urlencode($my_url) ;
    echo("<script>top.location.href='" . $dialog_url . "'</script>");
    }

    //get user access_token
    $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);

    // Run fql query
    $fql_query_url = 'https://graph.facebook.com/'
    . '/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()'
    . '&' . $access_token;
    $fql_query_result = file_get_contents($fql_query_url);
    $fql_query_obj = json_decode($fql_query_result, true);

    //display results of fql query
    echo '<pre>';
    print_r("query results:");
    print_r($fql_query_obj);
    echo '</pre>';

    // Run fql multiquery
    $fql_multiquery_url = 'https://graph.facebook.com/'
    . 'fql?q={"all+friends":"SELECT+uid2+FROM+friend+WHERE+uid1=me()",'
    . '"my+name":"SELECT+name+FROM+user+WHERE+uid=me()"}'
    . '&' . $access_token;
    $fql_multiquery_result = file_get_contents($fql_multiquery_url);
    $fql_multiquery_obj = json_decode($fql_multiquery_result, true);

    //display results of fql multiquery
    echo '<pre>';
    print_r("multi query results:");
    print_r($fql_multiquery_obj);
    echo '</pre>';
    ?>

  

For more information please see the FQL documentation. As part of this change, in the coming weeks, we will be moving all our FQL documentation into the Graph API documentation so that you can access all our reference APIs in one place.

Adding namespace property to application endpoint in Graph API

On the application object, we've added a property called namespace which returns the namespace for the app. The namespace is the canvas name of the app (e.g. https://apps.facebook.com/<namespace>) and is used to scope Open Graph objects and actions. Note that this property replaces the property previously called canvas_name.

Both namespace and canvas_name properties will be available for the next 90 days. We will be deprecating the canvas_name field in favor of namespace on February 1st 2012. We have updated the Roadmap to reflect this change.

Detecting visibility of Flash objects in Canvas apps functionality not working

For Flash applications on facebook.com using wmode=”window”, it is possible for the Flash objects to become hidden when popups occur, and then to be redisplayed when popups are dismissed. We recently launched the ability for apps to customize this behavior (e.g. show an image when this happens) by allowing them to pass in a callback function to the hideFlashCallback property passed in to FB.init.

We have discovered some bugs with the implementation and are still working through the issues; hence, this functionality is currently unavailable. We will post an update once these issues are resolved.

Breaking change reminder November 1st 2011

A friendly reminder about the breaking changes coming on November 1st:

  • manage_notifications permission migration — To read or manipulate a user’s notifications, we will require you to get the manage_notifications permission.

Bugs

Bugs activity for the past 7 days:

  • 745 total open bugs
  • 240 new bugs were reported
  • 23 bugs were reproducible and accepted (after duplicates removed)
  • 1 bugs was fixed

Facebook Stack Overflow Activity

Activity on facebook.stackoverflow.com this week:

  • 522 questions asked
  • 154 answered, 30% answered rate
  • 272 replied, 52% reply rate