Question

I'm trying to retrieve facebook insights data using the multiquery FQL method but to no avail. I've followed the instructions available on facebook's site.

Does anybody have any idea as to what might be missing or done wrong?

Queries (works using the Graph API Explorer)

SELECT metric, value FROM insights WHERE object_id=310852659027337 AND metric='page_views' AND period=86400 AND end_time=end_time_date('2014-01-16')

SELECT metric, value FROM insights WHERE object_id=310852659027337 AND metric='page_views_unique' AND period=86400 AND end_time=end_time_date('2014-01-16')

Request URL

https://graph.facebook.com/fql?access_token=access_token&format=json&queries=%7B%22page_views%22%3A+%22SELECT+metric%2C+value+FROM+insights+WHERE+object_id%3D310852659027347+AND+metric%3D%27page_views%27+AND+period%3D86400+AND+end_time%3Dend_time_date%28%272014-01-16%27%29%22%2C+%22page_views_unique%22%3A+%22SELECT+metric%2C+value+FROM+insights+WHERE+object_id%3D310852659027347+AND+metric%3D%27page_views_unique%27+AND+period%3D86400+AND+end_time%3Dend_time_date%28%272014-01-16%27%29%22%7D

Request URL (Decoded)

https://graph.facebook.com/fql?access_token=access_token&format=json&queries={"page_views": "SELECT metric, value FROM insights WHERE object_id=310852659027347 AND metric='page_views' AND period=86400 AND end_time=end_time_date('2014-01-16')", "page_views_unique": "SELECT metric, value FROM insights WHERE object_id=310852659027347 AND metric='page_views_unique' AND period=86400 AND end_time=end_time_date('2014-01-16')"}

Response

{"error":{"message":"(#601) Parser error: unexpected end of query.","type":"OAuthException","code":601}}
Was it helpful?

Solution

https://graph.facebook.com/fql?access_token=access_token&format=json&queries={"page_views": "SELECT metric, value FROM insights WHERE object_id=310852659027347 AND metric='page_views' AND period=86400 AND end_time=end_time_date('2014-01-16')", "page_views_unique": "SELECT metric, value FROM insights WHERE object_id=310852659027347 AND metric='page_views_unique' AND period=86400 AND end_time=end_time_date('2014-01-16')"}

No such parameter name named queries, the correct parameter name is q, i.e.

https://graph.facebook.com/fql?access_token=access_token&format=json&q={"page_views": "SELECT metric, value FROM insights WHERE object_id=310852659027347 AND metric='page_views' AND period=86400 AND end_time=end_time_date('2014-01-16')", "page_views_unique": "SELECT metric, value FROM insights WHERE object_id=310852659027347 AND metric='page_views_unique' AND period=86400 AND end_time=end_time_date('2014-01-16')"}

Documentation: https://developers.facebook.com/docs/technical-guides/fql/

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