Retrieving Advanced Data with FQL
I show you under the “Selectively Querying Information with Property Selection” section how to select specific data using Graph API using the fields parameter. At times, you need to get even more detailed. It's in these cases that having a little FQL knowledge can be a big help.
FQL (Facebook Query Language) is a query language that's very similar to SQL, which allows you to use select and where statements to selectively choose data that you want to retrieve from Facebook. FQL supports joins (through subselects) as well. It's a very complex way of retrieving specific sets of data in an organized manner. It can also be a great way to save on bandwidth and keep out all the fluff that Graph API can sometimes give. You should weigh whether Graph API or FQL gives you better results.
Unlike Graph API, FQL must be called by a slightly different URL, and it supports both a return format in XML and in JSON. At the time of this writing, FQL is one of the few things that are left over from the old REST API that Facebook used before Graph API, so by the time you read this, Facebook might have already converted FQL to the newer Graph API format. The URL you must call to make a FQL query is as follows:
https://api.facebook.com/method/fql.query?query=QUERY
To specify whether your FQL response returns as XML or JSON, also include a format parameter in the URL and specify XML or JSON as the value.
Queries
FQL supports much of the traditional syntax of SQL. The ...
Get Facebook® Application Development For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.