Facebook 图形 API:json 响应中缺少提要

发布于 2024-10-10 23:03:50 字数 3684 浏览 1 评论 0原文

我尝试通过我的 Android 应用程序中的 graph api 获取用户的 feed。它通常可以工作,但 json 响应中缺少我在墙上看到的一些提要。

我通过使用调用网址 http://graph.facebook.com/someUserId/feed Android Facebook SDK 方法,因此应该自动提供访问令牌,但我认为在我的情况下它并不真正相关。不过仅供参考,我的应用程序的用户是通过 OAuth 进行身份验证的。

我已经检查了以下内容:

  • 所有用户的提要对每个人/公众都是可见的(在隐私设置中设置)
  • 我的浏览器未缓存 json 响应
  • 我知道分页,但这不是问题。问题不在于我没有获得最旧的提要,而是有些提要在中间丢失了。
  • 我注册了一个新的 Facebook 用户,该用户未连接到我想要从中检索墙提要的用户,当我打开相应的墙时,我会看到那里的所有提要,正如预期的那样,因为它们都是对所有人公开的。然而,当我在 http://graph.facebook.com/someUserId/feed 下打开相同的相关 json url 时,缺少一些提要。

这是问题的一个例子 - 因为我所有的帖子都是公开的,所以我可以直接在浏览器中调用 json url 来进行测试。

我想从用户那里获取墙反馈: http://www.facebook.com/mathias.lin

屏幕截图1:注意 3 个标记的帖子,全部由我自己发布

alt text

,这里是 json 响应,如您所见,包括第 1 条和第 3 条墙贴在 json 中,但第二篇文章不是。为什么?

相关的 json url 是: http://graph.facebook.com/mathias.lin/feed

alt text

当我向网址添加 access_token 时,我收到“丢失”的提要 - 但为什么呢?发布的提要有针对“每个人”的隐私设置?!

这是我在使用 access_token 时得到的缺少的提要:

{"id":"504063796_485195138796","from":{"name":"Mathias Lin","id":"504063796"},"message":"Photo test upload from Android","picture":"http:\/\/photos-e.ak.fbcdn.net\/hphotos-ak-snc6\/hs021.snc6\/165194_485195123796_504063796_6062399_1841907_s.jpg","link":"http:\/\/www.facebook.com\/photo.php?fbid=485195123796&set=a.485195118796.256450.504063796","name":"Torres Photos","icon":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/yz\/r\/StEh3RhPvjk.gif","actions":[{"name":"Comment","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"},{"name":"Like","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"}],"privacy":{"description":"Everyone","value":"EVERYONE"},"type":"photo","created_time":"2011-01-06T05:10:43+0000","updated_time":"2011-01-06T09:00:23+0000","likes":6,"comments":{"data":[{"id":"504063796_485195138796_3607414","from":{"name":"Mathias Lin","id":"504063796"},"message":"Awesome, photo upload now works as well. Not so much fun working with the Facebook SDK for Android, would have expected more functionality beyond that just very very simple graph api wrapper. But need to be considered that the android sdk development was part of an internship - but since it's it's open source, it can luckily be modified. Which has to be done due to some bugs (mixing up the bundle parameters for a post, getString, getByteArray). Api documentation could be improved.","created_time":"2011-01-06T05:26:04+0000"},{"id":"504063796_485195138796_3608020","from":{"name":"Renate Hermanns","id":"628810487"},"message":"Wow
, how fast time passes by. Your daughter is nearly grown up ;-).","created_time":"2011-01-06T09:00:23+0000"}],"count":2},"attribution":"Torres"}

我已经将问题发布到 FB 开发论坛,等待回复。

相关主题:

http://forum.developers.facebook.net/viewtopic.php ?id=81365

http://forum.developers.facebook。 net/viewtopic.php?id=75984

Facebook Graph API "/ userid/feed" 返回空白

I try to fetch user's feeds via graph api from my Android application. It generally works but some feeds that I can see on the wall are missing in the json response.

I call the url http://graph.facebook.com/someUserId/feed, by using the Android Facebook SDK methods, so the access token should be provided automatically, but it's not really relevant I think in my case. Nevertheless fyi, the user of my app is authenticated via OAuth.

I already checked the following:

  • all the user's feeds are visible to everyone / public (set in privacy settings)
  • the json response is not cached by my browser
  • I am aware of paging, but this is not an issue. The problem is not that I am not getting the very oldest feeds but that some feeds are just missing in between.
  • I registered a new facebook user which is not connected to the user I want to retrieve the wall feeds from, and when I open the respective wall I see all the feeds there, as expected, since they're all public to everyone. Yet, when I open the same related json url unter http://graph.facebook.com/someUserId/feed, some feeds are missing.

This is an example of the problem - since all my posts are public, I can just call the json url directly in a browser to do a test.

I want to get wall feeds from user:
http://www.facebook.com/mathias.lin

Screenshot1: note the 3 marked postings, all posted by myself

alt text

and here the json response, as you can see, the 1st and 3rd wall posts are included in the json, but the 2nd post is not. Why?

The related json url is:
http://graph.facebook.com/mathias.lin/feed

alt text

I am getting the 'missing' feed when I add an access_token to the url - but why? The posted feed has a privacy setting for 'everyone'?!

This is the missing feed that I get when using the access_token:

{"id":"504063796_485195138796","from":{"name":"Mathias Lin","id":"504063796"},"message":"Photo test upload from Android","picture":"http:\/\/photos-e.ak.fbcdn.net\/hphotos-ak-snc6\/hs021.snc6\/165194_485195123796_504063796_6062399_1841907_s.jpg","link":"http:\/\/www.facebook.com\/photo.php?fbid=485195123796&set=a.485195118796.256450.504063796","name":"Torres Photos","icon":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/yz\/r\/StEh3RhPvjk.gif","actions":[{"name":"Comment","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"},{"name":"Like","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"}],"privacy":{"description":"Everyone","value":"EVERYONE"},"type":"photo","created_time":"2011-01-06T05:10:43+0000","updated_time":"2011-01-06T09:00:23+0000","likes":6,"comments":{"data":[{"id":"504063796_485195138796_3607414","from":{"name":"Mathias Lin","id":"504063796"},"message":"Awesome, photo upload now works as well. Not so much fun working with the Facebook SDK for Android, would have expected more functionality beyond that just very very simple graph api wrapper. But need to be considered that the android sdk development was part of an internship - but since it's it's open source, it can luckily be modified. Which has to be done due to some bugs (mixing up the bundle parameters for a post, getString, getByteArray). Api documentation could be improved.","created_time":"2011-01-06T05:26:04+0000"},{"id":"504063796_485195138796_3608020","from":{"name":"Renate Hermanns","id":"628810487"},"message":"Wow
, how fast time passes by. Your daughter is nearly grown up ;-).","created_time":"2011-01-06T09:00:23+0000"}],"count":2},"attribution":"Torres"}

I've already posted the question to the FB dev forum, awaiting response.

Related threads:

http://forum.developers.facebook.net/viewtopic.php?id=81365

http://forum.developers.facebook.net/viewtopic.php?id=75984

Facebook Graph API "/userid/feed" returning Blank

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

哽咽笑 2024-10-17 23:03:50

您的方法是正确的,我已经看到了 JSON,是的,它缺少第二个,我认为它是上传应用程序表单 adroid,请尝试检查此应用程序的应用程序设置。或者如果您尝试找回墙壁 FQL 是一个更好的方法

SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id=<uid> AND is_following=1) AND is_hidden = 0 

Your approach is correct, I've seen the JSON and yes it's missing the second one, I think it's upload app form adroid, try checking the application settings for this app. Or If your trying to retrieve the wall FQL is a much better way

SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id=<uid> AND is_following=1) AND is_hidden = 0 
我不会写诗 2024-10-17 23:03:50

我经历过这种情况,Facebook分类其权限的方式在某种程度上具有误导性,例如公开可用可能听起来像Facebook上的每个人都可以使用 但显然事实并非如此。

现在,在您的情况下,如果您已经对用户进行了身份验证,请尝试使用:

/me/feed

我想这是 URL 中不需要 access_token 的唯一情况。

I've been through this, the way Facebook is categorizing their permissions is somehow misleading, for example Publicly available may sounds like Available to everyone on Facebook but apperantly it's not.

Now in your case, if you already authenticated the user, then try using:

/me/feed

I guess this is the only case where access_token is not needed in the URL.

╰◇生如夏花灿烂 2024-10-17 23:03:50

我有类似的问题。但对我来说,问题与首次登录时未正确设置范围(授权应用程序)有关。我发布了一个类似的问题,并在这里得到了一个对我有用的答案:

Facebook API 如何获取所有墙项目

I had a similar problem. But for me, the problem was related to not setting the scope properly on first login (to authorize the app). I posted a similar question and got an answer that worked for me here:

Facebook API how to get all wall items

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文