Hi Ben,

  Can you try dumping the error that is returned by the request?  Try doing
something like this:

function loadFriend(friendId) {
  var req = opensocial.newDataRequest();
  req.add(req.newFetchPersonAppDataRequest(friendId), 'friend');
  req.send(respondToFriend);
};

function respondToFriend(data) {
  if (data.get('friend').hadError()) {
    alert(data.get('friend').getErrorMessage());
  }
  var friend = data.get('friend').getData();
  var thumb = friend.getField(opensocial.Person.Field.THUMBNAIL_URL);
  html = new Array();
  html.push('<img src="' + thumb + '" />');
  _gel('friend_profile').innerHTML = html;
};

loadFriend("101671739618776309584");

Note that the ID has to be a string, not a number.  When I run the above
code, I get the message: "unsupported id: 101671739618776309584"

~Arne



On Tue, Apr 22, 2008 at 2:27 PM, BenP <[EMAIL PROTECTED]> wrote:

>
> I'm building my first iGoogle Gadget in the new Open Social Sandbox
> and am having trouble getting a friend's profile from their ID.
>
> I have all of my friends in an ordered list, and want to click an
> individual friend and send a request to get that friend's profile,
> sending their ID (getID())
>
> My code is:
>
> href="javascript:loadFriend(101671739618776309584);"
>
>        function loadFriend(friendId)
>        {
>                var req = opensocial.newDataRequest();
>                req.add(req.newFetchPersonAppDataRequest(friendId),
> 'friend');
>                req.send(respondToFriend);
>        };
>
>        function respondToFriend(data)
>        {
>                var friend = data.get('friend').getData();
>                var thumb =
> friend.getField(opensocial.Person.Field.THUMBNAIL_URL);
>                html = new Array();
>                html.push('<img src="' + thumb + '" />');
>                _gel('friend_profile').innerHTML = html;
>        };
>
> But this doesn't work.
>
> The data.get('friend') returns an Object but
> data.get('friend').getData() returns null.
>
> I have tried both newFetchPersonAppDataRequest and
> newFetchPersonRequest. I've read the documentation and the API states:
> "Object newFetchPersonRequest(id, opt_params)
> Creates an item to request a profile for the specified person ID. When
> processed, returns a Person object."
>
> How do I get the full profile of a Single Friend from their ID?  I've
> searched everywhere, but all I can find is Lists of friends.
>
> Thanks, Ben
> >
>


-- 
OpenSocial IRC - irc://irc.freenode.net/opensocial

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenSocial Application Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to