1

我有一个 Facebook 页面的访问令牌。我可以查看该页面的提要以及该提要中的各个帖子。但由于某种原因,我只能使用 Graph API v2.2为其中一些/sharedposts请求端点。

访问令牌具有user_postsread_stream洞察力。当我请求该shares字段时,我可以看到多个带有共享的帖子,但是当我为其中一些请求[POST_ID]/sharedposts时,我只得到一个空data数组作为响应。

为什么是这样?有一些我应该注意的问题吗?有点令人沮丧的是,/sharedposts边缘将返回某些帖子的返回值,但使用相同的访问令牌和 API 版本的其他帖子不会。

4

2 回答 2

0

I just posted my insight/workaround for this bug on the bug report that lars.schwarz linked to, but I'll paste it here as well:

/sharedposts will only retrieve public posts or posts from users who have granted your app access. HOWEVER, the endpoint does not seem to query for this intelligently. I'm not sure, but I think the endpoint has a default limit of 25 results. What appears to be happening is that the endpoint queries Facebook's database for 25 posts, then filters that set based on your app's permissions.

What this means is that if the most recent sharedpost your app is allowed to access is 30 posts deep, the endpoint will return an empty data set. If your app is allowed to access one post which is 15 deep, and one that is 30 deep, it will only return the post that is 15 deep.

In order to get around this, you can set a really high limit (I've been using 2000). The problem with this is that if your post has more than 2000 shares, you will still miss stuff. You can't make the limit insanely high, unfortunately, because the endpoint will return an error telling you to query for less data (even if the query would only actually return a handful of posts). Therefore, I've been setting a limit of 2000 and using the "until" parameter to move through the sharedposts chronologically.

Hopefully that helps clear things up. This is a major pain, and an imperfect solution (although it gets 99% of the job done I think). I encourage everyone to file a bug report on this here: https://developers.facebook.com/bugs

It appears that this bug has been around for years, and I was told yesterday that they have no short-term plans to fix it. If we file enough complaints, maybe they'll prioritize it higher.

于 2017-05-12T15:17:58.707 回答
0

这是一个已知的错误,似乎仍未解决。

基本上它应该像您预期的那样工作,但即使有所有必要的许可(甚至对于公共帖子),它也不会返回每个共享的对象。

您可能希望在此处订阅该错误,以便在它解决后引起注意:

https://developers.facebook.com/bugs/1404733043148335/

于 2015-09-30T16:10:49.407 回答