Reputation: 6656
I'm using restfb 1.6.5 (the same problem in 1.6.4) and have problems getting the uids of my friends. This works fine (me-query):
User fbUserMe = fbClient.fetchObject("me", com.restfb.types.User.class);
logger.debug(fbUserMe.getId());
The response body contains something like: {"id":"1234","name":"ME" ...}
and fbUserMe.getId()
returns my uid. With the next code snipped I want to get the uids of my friends (friends-query):
StringBuffer sb = new StringBuffer();
sb.append("SELECT uid, first_name, last_name FROM user");
sb.append(" WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())");
List<User> users = fbClient.executeQuery(sb.toString(), User.class);
for(User fbUser : users)
{
logger.debug(fbUser.getId());
}
But this always outputs null
, although the response body contains this: [{"uid":5678,"first_name":"Peter" ...} ...]
.
The obvious difference in the response by is id=1234
for the me-query and uid=5678
for the friends-query. If I use a custom class FqlUser
like described in RestFB I'm able to get the uid. Now I'm uncertain of the uid. Do I really get same same id (the same my friend would get in a me-Query) or do I get something like the third_party_id described in Facebook: FQL-user?
Upvotes: 1
Views: 1197
Reputation: 3544
You're getting the uid. The same id your friend would get in a "me query".
Upvotes: 4