4

What's the difference between accessing user data with the Facebook Graph API (http://graph.facebook.com/btaylor) and using the Graph API to make a FQL query of the same user (https://api.facebook.com/method/fql.query?query=QUERY).

Also, does anyone know which of them the Facebook Developer Toolkit (for ASP.NET) uses?

The reason I ask is because I'm trying to access the logged in user's birthday after they begin a Facebook Connect session on my site, but when I use the toolkit it doesn't return it. However, if I make a manual call to the Graph API for that user object, it does return it. It's possible I might have something wrong with my call from the toolkit. I think I may need to include the session key, but I'm not sure how to get it. Here's the code I'm using:

_connectSession = new ConnectSession(APPLICATION_KEY, SECRET_KEY);
        try
        {
            if (!_connectSession.IsConnected())
            {
                // Not authenticated, proceed as usual.
                statusResponse = "Please sign-in with Facebook.";
            }
            else
            {
                // Authenticated, create API instance
                _facebookAPI = new Api(_connectSession);

                // Load user
                user user = _facebookAPI.Users.GetInfo();

                statusResponse = user.ToString();

                ViewData["fb_user"] = user;

            }
        }
        catch (Exception ex)
        {
            //An error happened, so disconnect session
            _connectSession.Logout();
            statusResponse = "Please sign-in with Facebook.";
        }
2
  • I am interested in the differences between the two as well. Commented May 28, 2010 at 19:28
  • Old topic-- but here's my .02: Open Graph abstracts away the the "sql" in Facebook SQL, and is a lot slower by design. If you are familiar with SQL, FBSQL is simply SQL queries to columns already defined by FB, & gives you more control over what's returned. More control over what's returned, more refined queries and smaller datasets gives you the benefit of performance improvements, and will always be faster than Open Graph-for making simple queries. Open graph would be better suited for complicated queries that require a lot of joins and subqueries-which you should avoid in the first place. Commented Nov 25, 2012 at 22:16

3 Answers 3

8

The Graph API and FQL are similar in that they both access the same underlying Facebook objects: the nodes that are collectively referred to as "the social graph". The Graph API is a simple, uniform, and fairly direct way to access these objects. If you know exactly what you're looking for, the Graph API is a simple way to get it.

FQL, on the other hand, is a query language (like SQL). It allows you to search for graph objects that would be impossible (or complicated) to find using the simple, direct Graph API.

Another big feature FQL has over the Graph API is the ability to batch multiple queries into a single call (which can save you a lot of time in roundtrips for multipart queries).

Ultimately, the Graph API seems a more direct representation of what's going on "under the covers" in the social graph, so I find it simpler to use when I can. But if my Graph API request is getting really long or incomprehensible (or any time I need to make more than one related query of the social graph), that's the sign that it's time to switch over to FQL.

Sign up to request clarification or add additional context in comments.

Comments

0

It seems the reason I couldn't get the birthday and other information I was looking for was because I didn't have a complete list of all the extended permissions that could be requested. I finally found the list at http://developers.facebook.com/docs/authentication/permissions (which included user_birthday).

If anyone has info about the FQL vs. Graph Object question, I'd still be interested in that. Though I think they are basically the same thing.

1 Comment

They access the same thing, but are actually quite different. See my answer above.
0

Looks like that have changed it (yes yet again). Because you are using facebook connect, you can ask for the permissions to give you the needed info for example user's birthday something like:

<fb:login-button perms="email,user_birthday"></fb:login-button>

More Information:

http://developers.facebook.com/docs/guides/web#login

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.