如何使用Graph API获取用户的帖子? [英] How to get user posts using Graph API?

查看:150
本文介绍了如何使用Graph API获取用户的帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用用户访问令牌从用户墙上抓取所有的公开帖子。我知道需要read_stream权限。但是这个权限现在已经被弃用了。



https://developers.facebook.com/docs/facebook-login/permissions#reference-read_stream


read_stream



此权限仅适用于使用Graph API版本
v2.3或更早版本的应用程序。


< blockquote>

我想使用版本v2.5,所以现在该怎么做?

解决方案

已过滤版本为:



/ me / posts 仅显示此人发布的帖子。



/ me / tagged 仅显示此人被标记的帖子。



您的应用需要创建该帖子的用户 user_posts 有人标记的帖子



然后您的应用程序可以读取:



从给予您权限的人员的时间轴帖子。
其他人在该人时间线上发的帖子。
其他人标记了该人的帖子。



如果您尝试从Feed中读取您的应用程序未被授权访问的数据,则call / .5 / user / feedrel =noreferrer> https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed



修改
从用户访问令牌,您只能获取该用户的身份和他的Facebook朋友谁是这个应用程序的用户。此外,所有这些用户必须向您的应用程序授予user_posts权限,否则它将只返回空数据集,如您所在



对于其他用户(已授予user_posts权限和当前访问令牌用户)feed use: / {user_id} / feed



{user_id} 也是您应用的用户)可在 / me / friends


I want to fetch all the public posts from a user's wall with my user access token. I know that read_stream permission is required for this. However this permission has been deprecated now.

https://developers.facebook.com/docs/facebook-login/permissions#reference-read_stream

read_stream

This permission is only available for apps using Graph API version v2.3 or older.

I want to use version v2.5, so how can I do this now?

解决方案

/me/feed gives you posts published by this person.

Filtered versions are:

/me/posts shows only the posts published by this person.

/me/tagged shows only posts that this person is tagged in.

Your app needs user_posts permission from the person who created the post or the person tagged in the post.

Then your app can read:

Timeline posts from the person who gave you the permission. The posts that other people made on that person Timeline. The posts that other people have tagged that person in.

If you attempt to read data from a feed that your app has not been authorized to access, the call will return an empty array.

For more details: https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed

Edit : From a user access token, you can only get feed of that user and his facebook friends who are users of this app. Also all those users must grant user_posts permission to your app otherwise it will return only empty data set like in your case

For other users ( who have granted user_posts permission and friend of current access token user ) feed use: /{user_id}/feed

{user_id} of friends ( who are also user of your app ) available in /me/friends

这篇关于如何使用Graph API获取用户的帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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