Question

This FQL multiquery, for example:

https://graph.facebook.com/fql?q={"posts":"SELECT actor_id,message,permalink,created_time,comments.count FROM stream WHERE source_id=me()","actors":"SELECT uid,name,pic_square,profile_url FROM user WHERE uid IN (SELECT actor_id FROM #posts)"}

works perfectly in the Graph API Explorer, but when you put it straight in a browser, you get:

{
        "error": {
        "message": "(#601) Parser error: unexpected '{' at position 0.",
        "type": "OAuthException"
    }
}

What am I missing here? Again something was deprecated by Facebook in their API? I want to do an FQL multiquery using GET (actually using JSONP at the end) - without using the Javascript SDK.

By the way, I am sure it's not an authorization/access_token issue.

Was it helpful?

Solution

URLencode the value of parameter q. :, # are special characters in a URL. Example:

https://graph.facebook.com/fql?q=%7B%22posts%22%3A%22SELECT%20actor_id%2Cmessage%2Cpermalink%2Ccreated_time%2Ccomments.count%20FROM%20stream%20WHERE%20source_id%3Dme%28%29%22%2C%22actors%22%3A%22SELECT%20uid%2Cname%2Cpic_square%2Cprofile_url%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20actor_id%20FROM%20%23posts%29%22%7D

If your are using PHP use something like this:

$url = 'https://graph.facebook.com/fql?q=' . urlencode($my_fql_query);

OTHER TIPS

You need to use: https://graph.facebook.com/fql?queries=...

Don't use 'q', use the param name 'queries'.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top