简体   繁体   English

无法使用Android中的Facebook graph API查找喜欢和评论计数

[英]not able to find likes and comments count using Facebook graph API in android

Previously(5-6 months ago approx) with the request https://graph.facebook.com/me/home?limit=20&access_token=MY_ACCESS_TOKEN&format=json I was getting in response 20 Facebook feeds in json format with likes and comments count inside each of those 20 feeds. 以前(大约5-6个月前),有请求https://graph.facebook.com/me/home?limit=20&access_token=MY_ACCESS_TOKEN&format=json我得到的回应是20个json格式的Facebook feed,其中包含喜欢和评论这20个Feed中的每一个。

But now the I'm not getting likes and comments count in the response. 但是现在我没有得到喜欢和评论。 only that part is missing in the response. 响应中仅缺少该部分。

Please tell me why now I'm not getting counts? 请告诉我为什么现在我没有计数? If Facebook have changed their API, is it possible to get the count in the same request by just modifying or adding some parameters to it? 如果Facebook更改了API,是否可以通过仅修改或添加一些参数来在同一请求中获得计数? And if not then what i have to do. 如果没有,那我该怎么办。

I got the solution, just adding likes.summary(true),comments.summary(true) in parameter in against "fields" worked for me. 我得到了解决方案,只是在反对“ fields”的参数中添加了likes.summary(true),comments.summary(true)对我likes.summary(true),comments.summary(true)

eg I used https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN&fields=story,from,story_tags,likes.summary(true),comments.summary(true) 例如我使用https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN&fields=story,from,story_tags,likes.summary(true),comments.summary(true)

instead of https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN 而不是https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN

Also you can add other parameters if you want; 您也可以根据需要添加其他参数。 separated by a , 以分隔,

Also if you want count of single post you can use 另外,如果您想统计单个帖子,则可以使用

https://graph.facebook.com/POST_ID/likes?summary=true&access_token=ACCESS_TOKEN

for likes count 为喜欢计数

Or 要么

    https://graph.facebook.com/POST_ID/comments?summary=true&access_token=ACCESS_TOKEN

for comment count 进行评论计数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM