How can I execute a FQL query with Facebook Graph API

user63898 picture user63898 · Apr 27, 2010 · Viewed 81k times · Source

I'm looking without any success for a way to execute a FQL(facebook query language) query with the new Open Graph API.

Does anyone know how I can do this?

Found the answer here with this excellent example: http://code.google.com/p/facebook-cpp-graph-api/

Answer

mjallday picture mjallday · May 26, 2010

Here's an example of how to do a FQL query using the Graph API and JavaScript

FB.api(
        {
            method: 'fql.query',
            query: 'SELECT uid, first_name, last_name FROM user WHERE uid = ' + someUid
        },
        function(data) {
            //    do something with the response
        }
);

This assumes you've already setup your page according to the Facebook guidelines as shown here - http://developers.facebook.com/docs/reference/javascript/