Shirish Herwade
Shirish Herwade

Reputation: 11701

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.

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? And if not then what i have to do.

Upvotes: 1

Views: 924

Answers (1)

Shirish Herwade
Shirish Herwade

Reputation: 11701

I got the solution, just adding likes.summary(true),comments.summary(true) in parameter in against "fields" worked for me.

e.g. I used 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

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

Upvotes: 2

Related Questions