Facebook FQL / Graph - 获取所有当前的 Poke

发布于 2024-11-17 15:15:13 字数 77 浏览 2 评论 0原文

我怎样才能得到我当前的戳(和戳回来)?

通常它们必须在“通知”表中......我很困惑。

希望有人能帮助我。

How can I get my current pokes (and pokes back)?

Normaly they must be in the table "notification" ... I am confused.

Hope someone can help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝色星空 2024-11-24 15:15:13

这是一个工作示例,提示 read_mailbox 权限并使用 /me/pokes 检索用户 pokes。这也可以使用相同的逻辑以任何服务器端语言来完成。

获取戳:

<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getPokes();return false;">Get Pokes</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({ appId  : '**yourAppID', status : true, cookie : true, xfbml  : true });

  function getPokes() {  
    FB.login(function(response) {
      if (response.session && response.perms) {
        FB.api('/me/pokes',  function(response) {
            for(var i=0; i < response.data.length; i++) {
              alert(response.data[i].from.name + " poked you.");
            }
          }
        );
      }
    } , {perms:'read_mailbox'}); 
}
</script>
</body>
</html>

戳回来:
要回拨用户,您可以向 /userid/pokes 发出 HTTP Post,但您需要被 Facebook 列入白名单。否则你会得到这样的回复:

{
  error: {
    type: "OAuthException",
    message: "(#3) Application does not have the capability to make this API call.",
  }
}

Here is a working example that prompts for read_mailbox permission and uses /me/pokes to retrieve a users pokes. This can be done in any server side language too using the same logic.

Get Pokes:

<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
<a href="#" onclick="getPokes();return false;">Get Pokes</a>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({ appId  : '**yourAppID', status : true, cookie : true, xfbml  : true });

  function getPokes() {  
    FB.login(function(response) {
      if (response.session && response.perms) {
        FB.api('/me/pokes',  function(response) {
            for(var i=0; i < response.data.length; i++) {
              alert(response.data[i].from.name + " poked you.");
            }
          }
        );
      }
    } , {perms:'read_mailbox'}); 
}
</script>
</body>
</html>

Poke back:
To poke a user back, you would issue an HTTP Post to /userid/pokes but you need to get whitelisted by Facebook. Otherwise you will get this response:

{
  error: {
    type: "OAuthException",
    message: "(#3) Application does not have the capability to make this API call.",
  }
}
执妄 2024-11-24 15:15:13

使用图形 API,当然使用正确的访问令牌(您需要“read_mailbox”权限”),访问 https ://graph.facebook.com/me/pokes

将图形 API 中的“me”替换为您有权访问的 Facebook UID。

Using the graph API, using the right access token of course (you need the "read_mailbox" permission"), access https://graph.facebook.com/me/pokes

Replace "me" in the graph API for a Facebook UID you have permission to access to.

我还不会笑 2024-11-24 15:15:13

以下是关于如何获取通知的 Facebook REST 文档,应该包括波克斯。

"If you are building an application that notifies users of new messages/pokes/shares, we encourage you to use the following logic..."

Here are the Facebook REST docs for how to get notifications, which should include Pokes.

"If you are building an application that notifies users of new messages/pokes/shares, we encourage you to use the following logic..."
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文