Facebook API:一个奇怪的查询错误601

时间:2011-02-15 20:16:26

标签: facebook

我在尝试获取Facebook上特定链接的份额和喜欢时遇到此错误:

{
 "error_code":601,"error_msg":"
 Parser error: unexpected ''' at position 56.",
 "request_args":
          [{"key":"method","value":"fql.query"},
           {"key":"format","value":"json"},
           {"key":"query","value":"SELECT share_count, like_count FROM link_stat WHERE
             url='http://www.lrinka.lt/index.php?act=main"},
           {"key":"item_id","value":"5963'"}]
}

链接:http://www.lrinka.lt/index.php?act=main&item_id=5963

API调用:https://api.facebook.com/method/fql.query?format=json&query=SELECT%20share_count,%20like_count%20FROM%20link_stat%20WHERE%20url=%27http://www.lrinka.lt/index.php?act=main&item_id=5963%27

其他链接一切正常。

1 个答案:

答案 0 :(得分:4)

您没有正确关闭url参数字段,在网址末尾缺少'

也不需要“斜杠”,请在fql.query控制台中尝试以下操作:

SELECT share_count, like_count FROM link_stat WHERE url='http:\/\/www.lrinka.lt\/index.php?act=main

会返回相同的错误,并且:

SELECT share_count, like_count FROM link_stat WHERE url='http:\/\/www.lrinka.lt\/index.php?act=main'

有效但会返回零,最后是:

SELECT share_count, like_count FROM link_stat WHERE url='http:\\www.lrinka.lt\index.php?act=main'

会返回预期的结果。

修改
根据您的评论,您尝试将https://api.facebook.com/method/fql.query?query=QUERY参数设置为format来调用json ..因此您需要对查询进行编码,我使用了encodeURI

https://api.facebook.com/method/fql.query?format=json&query=SELECT%20share_count,%20like_count%20FROM%20link_stat%20WHERE%20url='http:%5Cwww.lrinka.ltindex.php?act=main'