My application is currently using the Graph API to fetch Facebook's data. Can I use FQL also? If I can, then how?





Appreciate if you can like this page if you find it useful! - Click "Like"

First of all, let's see how Facebook describes FQL:

Facebook Query Language, or FQL, enables you to use a SQL-style interface to query the data exposed by the Graph API. It provides for some advanced features not available in the Graph API, including batching multiple queries into a single call.

You can execute FQL queries by fetching You can specify a response format as either XML or JSON with the format query parameter.

So, there shouldn't be any conflict to use both FQL and the Graph API in your application to fetch the data.

If you have used the Old REST API before, you probably have already noticed the URL for executing FQL queries are similar to that for the Old REST API (i.e. ). So, invoking FQL queries from your application should be very similar to that for invoking the Old REST API.

In your are using a SDK, it should be even easier to execute FQL query. Examples on how to execute a FQL query in various SDKs are given below:

  • For the JavaScript SDK,

    var query = FB.Data.query('select publish_stream from permissions where uid={0}', response.session["uid"]);

  • For the PHP SDK,
    $response = $facebook->api(array(
      'method' => 'fql.query',
      'query' => 'SELECT name FROM profile WHERE id=4',



Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!