我试图使用多查询FQL方法检索facebook洞察数据,但无济于事。我遵循了Facebook的site上的说明。Facebook图形API:解析器错误:查询意外结束
有没有人有任何想法可能会失踪或做错?
查询(作品使用图形API浏览器)
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')
请求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
请求URL(解码)
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')"}
响应
{"error":{"message":"(#601) Parser error: unexpected end of query.","type":"OAuthException","code":601}}
该工程。谢谢。 Facebook的api文档有不正确的信息。它提到传递一个名为“queries”的查询参数(https://developers.facebook.com/docs/technical-guides/fql/)。 Facebook的API文档说“ 在一次调用中评估一系列FQL(Facebook查询语言)查询并一次返回数据。 该方法采用名为''queries'的JSON编码字典,其中各个查询使用与简单查询完全相同的语法。“ – Saimon