Fetch all likes of a post

498 views
Skip to first unread message

Amirhossein Aleyasin

unread,
Apr 30, 2013, 5:53:56 PM4/30/13
to res...@googlegroups.com

Hi all,
I try to fetch likes of post (not only count). I used fetchConnections:

Connection<Post.Likes> likes = facebookClient.fetchConnection(postID + "/likes", Post.Likes.class);

and I iterate over collection like this :

for (List<Post.Likes> likePage : likes) {
        for (Post.Likes like : likePage) {
               System.out.println(like+" "+like.getData()+" "+like.getCount());
        }
 }

and output:
Likes[count=null data=[]] [] null
Likes[count=null data=[]] [] null
Likes[count=null data=[]] [] null
... ...

however the post has likes but the return collection is empty! I'll be thankful if you can guide me to solve the problem. how I can get all likes of a post?

Thanks




Marcel Stör

unread,
May 1, 2013, 3:08:11 AM5/1/13
to res...@googlegroups.com
On 30.04.13 23:53, Amirhossein Aleyasin wrote:
>
> Hi all,
> I try to fetch likes of post (not only count). I used fetchConnections:
[...]
> however the post has likes but the return collection is empty! I'll be
> thankful if you can guide me to solve the problem. how I can get all
> likes of a post?

- See what you get when you use the Graph API Explorer[1].
- Compare the JSON from the Explorer with the JSON when using RestFB[2].
- If they're identical but you don't get any data through the API
consider opening an issue on GitHub[3].

Cheers,
Marcel

[1] http://developers.facebook.com/tools/explorer
[2] http://restfb.com -> logging
[3] https://github.com/revetkn/restfb/issues

--
Marcel Stör, http://frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Shai Berger

unread,
May 1, 2013, 3:21:34 AM5/1/13
to res...@googlegroups.com
By what I've seen, you can't actually get the individual likes, just the count
(Facebook API limitation, not restfb). You can get the individual likes as
they happen, using Real Time Updates.

But I may remember wrong,

Shai.
Reply all
Reply to author
Forward
0 new messages