使用 Facebook 的 Javascript SDK 运行 FQL 查询 [英] Running an FQL query using Facebook's Javascript SDK

查看:35
本文介绍了使用 Facebook 的 Javascript SDK 运行 FQL 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的查询:

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 运行它.我该怎么做呢?我不确定语法和格式.上面的 FQL 查询在我在 Open Graph Explorer(FBL 部分)中运行时有效,但我无法让它在 Graph API 部分中运行.

and I need to run it using the Javascript SDK. How do I do this? I'm not sure about the syntax and formatting. The above FQL query works when I run it in the Open Graph Explorer (FBL section) but I can't manage to get it to work in the Graph API section.

谢谢

推荐答案

你可以通过 JS SDK 的 FB.api() 方法运行这个(https://developers.facebook.com/docs/javascript/reference/FB.api) 通过使用

You can run this via the FB.api() method of the JS SDK (https://developers.facebook.com/docs/javascript/reference/FB.api) by using the

/fql?q=

端点如果你像这样对你的查询进行 URL 编码

endpoint if you URL encode your query like this

/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);
});

别忘了添加您的访问令牌!

Don't forget to add your Access Token!

这篇关于使用 Facebook 的 Javascript SDK 运行 FQL 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆