API: Get commenter's username/thumbnail from comment info

Nov 12, 2009 at 6:21 PM
Edited Nov 12, 2009 at 9:59 PM

(Cross-posted at http://forum.developers.facebook.com/viewtopic.php?pid=182507#p182507)

I don't know if this is an API problem, a FD Toolkit problem, an extended permissions problem, or what. But when getting the stream feed items' comments, the comment data includes the message and the commenter's user ID, but not the commenter's display name nor the commenter's thumbnail image URL.

I've tried referencing these API points and in some cases I still get null:

private user GetFBUserInfo(long id)
{
    if (FriendsCache.ContainsKey(id)) return FriendsCache[id];
    var friends = _API.Friends.GetAppUsersObjects();
    foreach (var friend in friends)
    {
        FriendsCache[friend.uid.Value] = friend;
    }
    if (FriendsCache.ContainsKey(id)) return FriendsCache[id];
    var user = _API.Users.GetInfo(id);
    if (user != null)
    {
        FriendsCache[id] = user;
        return user;
    }
    var users = _AppAPI.Users.GetStandardInfo(id.ToString());
    if (users.Count > 0) return users[0];
    return null;//throw new ArgumentException("Cannot find a friend with that name.");
}

Stepping through the execution code of _API.Users.GetInfo(id), here's what I see ..

going out:

  • method=facebook.users.getInfo
  • uids=#########,
  • fields= uid, about_me, activities, ... etc ...
  • session_key=########,
  • api_key=########,
  • v=1.0,
  • call_id=#########
  • ss=1,
  • sig=####################

.. and coming back:

  • list=true
  • listSpecified=true
  • user=[list of user].Count=0
<?xml version="1.0" encoding="UTF-8"?>
<users_getInfo_response xmlns="http://api.facebook.com/1.0/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd"
list="true"/>

Any ideas?

Nov 12, 2009 at 9:10 PM

Get the user ID returned from the comment and use:

api.users.getInfo(PUT_ID_HERE).pic_square;

Nov 12, 2009 at 9:38 PM
Edited Nov 12, 2009 at 9:39 PM
Serapth wrote:

Get the user ID returned from the comment and use:

api.users.getInfo(PUT_ID_HERE).pic_square;

 I tried that, @ line 10 in the snippet above, var user = _API.Users.GetInfo(id); .. it's null.

Nov 12, 2009 at 10:09 PM
Edited Nov 12, 2009 at 10:15 PM

This seems to be happening only for some of the IDs, not all of them.