如何通过页面获取状态更新-Facebook Graph API

如何通过页面获取状态更新-Facebook Graph API,facebook,facebook-graph-api,Facebook,Facebook Graph Api,我正在创建一个桌面应用程序,在这个应用程序中,我只需要获取页面本身发布的状态更新的post_id,没有照片、视频和其他故事/类型。我使用类型参数来轻松地完成此任务 https://graph.facebook.com/{username or ID of page}/posts?fields=object_id,type&limit=250&access_token={my access token} 返回带有类型和帖子ID的帖子列表的给定URL My Page Updated

我正在创建一个桌面应用程序,在这个应用程序中,我只需要获取页面本身发布的状态更新的post_id,没有照片、视频和其他故事/类型。我使用类型参数来轻松地完成此任务

https://graph.facebook.com/{username or ID of page}/posts?fields=object_id,type&limit=250&access_token={my access token}
返回带有类型和帖子ID的帖子列表的给定URL

My Page Updated a Status
{
 "type": "status",
 "id": "493341197400693_627621933972618",
 "created_time": "2014-04-05T18:31:58+0000"
},
它工作正常,但问题是列表中的某些帖子类型=status不是状态更新,这是一个故事,即我的页面在照片上发表了评论

如果两个响应的类型都是status,那么如何确认它是状态更新还是故事。 我只想忽略我的页面对照片的评论或我的页面喜欢照片等,有什么建议吗


对不起,我的英语不好。

您可以查找“消息”字段。状态应该有一个与之关联的“消息”字段,而像“我的页面像照片”这样的故事不应该有“消息”。下面是一些php代码示例

if (array_key_exists("message", $post))
    //is a status
修改图形调用以包含消息,如下所示


{username或ID of page}/posts?fields=object_ID,type,message&limit=250&access_token={my access token}

查看流FQL表。您可以使用字段类型将帖子过滤到比Graph API更精细的级别:

文件摘录:

The type of this story. Possible values are:
11 - Group created
12 - Event created
46 - Status update
56 - Post on wall from another user
66 - Note created
80 - Link posted
128 -Video posted
247 - Photos posted
237 - App story
257 - Comment created
272 - App story
285 - Checkin to a place
308 - Post in Group

hmmm所以我需要在图url中添加message参数,然后从json响应中逐个读取每个帖子,如果posts数据中存在message参数,并且帖子的类型等于status,那么它100%是由页面所有者制作的帖子。答案是可以接受的。很高兴它帮助了您:不幸的是,我不熟悉FQL,但它看起来比graph api简单得多,一个整数可以告诉您文章的实际类型。谢谢你,托比,我会在完成当前项目后尝试FQL。
The type of this story. Possible values are:
11 - Group created
12 - Event created
46 - Status update
56 - Post on wall from another user
66 - Note created
80 - Link posted
128 -Video posted
247 - Photos posted
237 - App story
257 - Comment created
272 - App story
285 - Checkin to a place
308 - Post in Group