Facebook Graph API:分析器错误:意外的查询结束

时间:2014-02-25 23:58:14

标签: facebook facebook-graph-api facebook-fql fql.multiquery

我正在尝试使用多查询FQL方法检索Facebook洞察数据,但无济于事。我按照facebook site上提供的说明进行操作。

是否有人知道可能遗漏或做错的事情?

查询(使用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')

请求网址

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

请求网址(已解码)

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}}

1 个答案:

答案 0 :(得分:1)

  

https://graph.facebook.com/fql?access_token=access_token&format=json&queries= { “PAGE_VIEWS”:   “SELECT metric,值FROM insight WHERE object_id = 310852659027347   AND metric ='page_views'和句点= 86400 AND   end_time = end_time_date('2014-01-16')“,”page_views_unique“:”SELECT   度量,值FROM洞察WHERE object_id = 310852659027347 AND   metric ='page_views_unique'和句点= 86400 AND   END_TIME = end_time_date( '2014年1月16日')“}

没有名为查询的参数名称,正确的参数名称为 q ,即

https://graph.facebook.com/fql?access_token=access_token&format=json&q= {“page_views”:“SELECT指标,值FROM洞察WHERE object_id = 310852659027347 AND metric ='page_views'AND period = 86400 AND end_time = end_time_date('2014-01-16')”,“ page_views_unique“:”SELECT指标,值FROM见解WHERE object_id = 310852659027347 AND metric ='page_views_unique'AND period = 86400 AND end_time = end_time_date('2014-01-16')“}

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