Facebook Graph API:如何过滤首页 &按应用提供? [英] Facebook Graph API: How to filter home & feed by application?

查看:20
本文介绍了Facebook Graph API:如何过滤首页 &按应用提供?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook Graph API 可让您获取主页(新闻提要)的 JSON 表示和饲料(墙).

The Facebook Graph API lets you grab a JSON representation of home (News Feed) & feed (Wall).

如何只获取我的 Facebook 应用发布的帖子?

How do I just get the posts made by my Facebook app?

推荐答案

您现在可以运行 Facebook 查询语言 (FQL) 使用 Facebook Graph API(基本网址:https://graph.facebook.com).

You can now run Facebook Query Language (FQL) queries using the Facebook Graph API (base URL: https://graph.facebook.com).

假设您的应用程序是 Twitter.Twitter 的 Facebook 应用 ID 为 2231777543.

Let's say your application is Twitter. Twitter's Facebook application ID is 2231777543.

我在 @danontheline 的回答 并仔细阅读 Facebook 关于 FQL 流 &FQL 流过滤器.

I came up with the FQL queries below with the help of @danontheline's answer and by carefully reading Facebook's documentation on FQL stream & FQL stream_filter.

以下摘录特别相关:

如果您从 stream_filter FQL 表中指定了 filter_key 或多个用户,返回的结果将表现得像用户的主页新闻提要.如果只将一个用户指定为 source_id,您将接收用户或页面的个人资料视图.你可以过滤这些通过指定 filter_key 'others'(仅返回由指定用户以外的其他人发布的帖子)或所有者"(仅返回指定用户发表的帖子).个人资料视图,与主页视图不同,从我们的数据库返回旧数据.在对于主页,个人资料视图还包括粉丝的帖子.

If you specify a filter_key from the stream_filter FQL table or multiple users, results returned will behave like the user's homepage news feed. If only one user is specified as the source_id, you will receive the profile view of the user or page. You can filter these profile view posts by specifying filter_key 'others' (return only posts that are by someone other than the specified user) or 'owner' (return only posts made by the specified user). The profile view, unlike the homepage view, returns older data from our databases. In the case of a Page, the profile view also includes posts by fans.

在您的 Facebook 新闻提要上的 Twitter 推文

GET /fql?q=SELECT post_id, actor_id, message, app_id, attribution FROM stream WHERE filter_key = 'app_2231777543'

Facebook 墙上的 Twitter 推文

GET /fql?q=SELECT post_id, actor_id, message, app_id, attribution FROM stream WHERE source_id = me() AND app_id = '2231777543' LIMIT 1000

使用 Facebook Graph API Explorer 运行这些查询会返回 Facebook Graph API post 对象(结果集会因 access_token 而异,隐私等).您可以通过将流表的其他列添加到上述查询中和/或通过为每个 post_id<向 GET/{post_id} 发出另一个 Graph API 请求来了解有关每个帖子的更多信息/code> 由上面的 FQL 流查询返回.

Running these queries with the Facebook Graph API Explorer returns Facebook Graph API post objects (The result set will differ depending on access_token, privacy, etc.). You can find out more about each post by adding other columns of the stream table to the queries above and/or by simply making another Graph API request to GET /{post_id} for eache post_id returned by the FQL stream queries above.

这篇关于Facebook Graph API:如何过滤首页 &amp;按应用提供?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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