Search code examples
facebook-fqlrestfb

Facebook: FQL for fetching all posts on a managed page throws one of two exceptions


I am using the RestFB client to fetch all post_ids of a Facebook Page.

The query is

select post_id from stream where source_id=265813166783408

Where the id if of the page I'm querying. It can be found here

I initially tried executing this without an access token. This gives a 104: Requires valid signature error from Facebook.

I looked up this error and the solution that many gave on SO is to use an access token. However if I try with an accessToken (with permissions: manage_pages, publish_stream, read_stream, offline_access, read_insights) then Facebook gives a different error 190: Impersonated access tokens can only be used with the Graph API.

Does this mean I shouldn't use FQL for getting page posts. The Facebook documentation doesn't mention anything on these lines but like I said it keeps alternating between these two errors.

PS: I can use the Graph API with my access token to fetch Posts but for my specific scenario I felt FQL would be a far better option, since I can nest this query into a query on the comments table (eventual aim).

Thank you.

UPDATE:

Please see Facebook developers for a discussion on this particular issue If you are using the RestFB library then also see the relevant issue


Solution

  • We encountered the same problem and found it to be an issue with using fbclient library and a page access token. We switched to calling the API directly (with the Apache HttpClient) and our FQL ran fine with the page access tokens.