使用RestFB访问所有墙上的帖子

时间:2016-05-16 11:36:35

标签: facebook facebook-graph-api restfb

我正在尝试使用RestFB访问我墙上的所有帖子,但出于某种原因,我在某个时间段内所有朋友的帖子都会折叠成一个“故事”。为了弄清楚发生了什么,我尝试从Graph Explorer中查询我的Feed,这就是我所看到的:

"data": [
{
  "story": "ABC and 2 others wrote on your Timeline.",
  "created_time": "2016-05-16T10:41:02+0000",
  "id": "137024370031572_17180606569835"
},
{
  "story": "XYZ wrote on your Timeline.",
  "created_time": "2016-04-16T23:59:10+0000",
  "id": "137024370031572_137091220024887"
},
{
  "message": "Hello, World!",
  "created_time": "2016-04-16T23:58:25+0000",
  "id": "137024370031572_137090520024957"
}, 
{
  "message": "Hey!",
  "created_time": "2016-04-16T23:12:50+0000",
  "id": "137024370031572_137049793362363"
},
{
  "message": "Yo",
  "created_time": "2016-04-16T23:05:39+0000",
  "id": "137024370031572_137040810029928"
}

我在自己的墙上发布的帖子显示为单独的“消息”,但我所有朋友的帖子都集体显示为一个故事,如果我尝试将它们打印出来,我只会看到最新的帖子,其消息是空值。这是我在终端上看到的代码和输出:

Connection<Post> myFeed = facebookClient.fetchConnection("me/feed", Post.class);
    for (List<Post> feed: myFeed) {
        for (Post post: feed) {
                System.out.println(post.getFrom().getName());
                System.out.println(post.getMessage());
        }
    }

输出:

ABC
null
XYZ
null
<My Name>
Hello, World!
<My Name>
Hey!
<My Name>
Yo

任何人都知道我做错了什么?或者我如何才能使这项工作?我的用户数据权限包括p​​ublish_actions,user_friends和user_posts。

0 个答案:

没有答案
相关问题