这是我的疑问:
select uid, name, is_app_user from user where uid in (select uid2 from friend where uid1=me()) and is_app_user=1
我需要使用Javascript SDK运行它。我该怎么做呢?我不确定语法和格式。当我在Open Graph Explorer(FBL部分)中运行它时,上面的FQL查询有效,但我无法在Graph API部分中使用它。
由于
答案 0 :(得分:3)
您可以使用
通过JS SDK(https://developers.facebook.com/docs/javascript/reference/FB.api)的FB.api()方法运行此方法/fql?q=
端点,如果您对此查询进行URL编码
/fql?q=select%20uid%2C%20name%2C%20is_app_user%20from%20user%20where%20uid%20in%20(select%20uid2%20from%20friend%20where%20uid1%3Dme())%20and%20is_app_user%3D1&access_token={YOUR_USER_ACCESS_TOKEN}
JS代码看起来像这样:
FB.api('/fql?q=select%20uid%2C%20name%2C%20is_app_user%20from%20user%20where%20uid%20in%20(select%20uid2%20from%20friend%20where%20uid1%3Dme())%20and%20is_app_user%3D1&access_token={YOUR_USER_ACCESS_TOKEN}', function(response) {
console.log(response);
});
不要忘记添加您的访问令牌!
答案 1 :(得分:2)
通过FB.api
-
FB.api("/fql?q="+encodeURIComponent('{your-query}'), function(response) {
if (!response || response.error) {
console.log('Error occurred: '+response.error.message);
} else {
console.log(response);
}
});