简体   繁体   中英

Facebook Graph API - “get likes of a comment of a picture” query returns empty array

Hello Facebook gurus:)

I'd like some help on this one

This is a post I made on a picture and then I liked it:

{
"created_time" = "2011-06-07T23:23:19+0000";
from =     {
    id = xxxxxxxxxxxxxx;
    name = "Adrien xxxxxxxx";
};
id = "107817942643477_24293";
likes = 1;
message = baar;
"user_likes" = 1;
}

I'm trying to get the userID's of friends/me who liked this comment I made on a picture

I made this: https://graph.facebook.com/107817942643477_24293/likes?access_token=TOKEN

I tried too with Fql:

NSString *theQuery = [NSString stringWithFormat:@"SELECT likes FROM stream WHERE post_id=\"%@\"", postID];
id theResult = [[AppDelegate sharedFacebook]
    sendSynchronousRequestWithMethodName:@"fql.query"
    andParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:
    theQuery, @"query", nil]
    andHttpMethod:@"GET"];

It doesn't work, maybe because this comment is liked to a picture and I should format the request differently?

The only thing I'm receiving is an empty array

{
data =     (
);
}

What am I doing wrong? Thanks in advance for any help on this one.

Ps: I'm using the iOS Facebook library, could it be broken?

You need to include the user id. Taking the example from the Facebook documentation here:

http://developers.facebook.com/docs/reference/api/Comment/

Click on the link there and add '/likes' before the query string containing the access token:

https://graph.facebook.com/19292868552_475058873552_14173716/likes?access_token=2227470867|2.AQDprvRAYwU-6lHe.3600.1309028400.0-604597322|Z4r0uxTK5ctlAn5rbs2NUNYZr88

If you remove the user id from the id, however...

https://graph.facebook.com/475058873552_14173716/likes?access_token=2227470867|2.AQDprvRAYwU-6lHe.3600.1309028400.0-604597322|Z4r0uxTK5ctlAn5rbs2NUNYZr88

...it won't work.

So you need to manually add the user id to your comment id if it's not already present.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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