person.getField always returns null

1 view
Skip to first unread message

Rakesh

unread,
Apr 17, 2008, 6:14:05 AM4/17/08
to OpenSocial - OpenSocial Application Development
Person.getField always returns null for any parameter that I pass to
the method. Could someone reason it out please?

mini

unread,
Apr 17, 2008, 6:33:12 AM4/17/08
to OpenSocial - OpenSocial Application Development
Hello Rakesh,

Use following-

viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);

Rakesh

unread,
Apr 17, 2008, 6:55:14 AM4/17/08
to OpenSocial - OpenSocial Application Development
This works fine... But what about the other fields listed out in API
documentation? Even the PROFILE_URL returns null.

Another problem I am facing is, when I do
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS),
'viewerFriends');

it returns me a list of only 20 friends in the callback function while
I have more than 150 friends in my friendlist. How do I get the
complete list of friends?
> > the method. Could someone reason it out please?- Hide quoted text -
>
> - Show quoted text -

Meenu gupta

unread,
Apr 17, 2008, 6:58:54 AM4/17/08
to opensoc...@googlegroups.com
Actually all fields are not supported by all containers.

Rakesh

unread,
Apr 17, 2008, 7:04:05 AM4/17/08
to OpenSocial - OpenSocial Application Development
I am working on Orkut... May be other fields are not supported.

Got any clue why only a few friends are returned in
newFetchPeopleRequest?


On Apr 17, 3:58 pm, "Meenu gupta" <rose.star.me...@gmail.com> wrote:
> Actually all fields are not supported by all containers.
>
>
>
> On Thu, Apr 17, 2008 at 4:25 PM, Rakesh <rakesh_n...@yahoo.com> wrote:
>
> > This works fine... But what about the other fields listed out in API
> > documentation? Even the PROFILE_URL returns null.
>
> > Another problem I am facing is, when I do
>
> > req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIEN­DS),
> > 'viewerFriends');
>
> > it returns me a list of only 20 friends in the callback function while
> > I have more than 150 friends in my friendlist. How do I get the
> > complete list of friends?
>
> > On Apr 17, 3:33 pm, mini <rose.star.me...@gmail.com> wrote:
> > > Hello Rakesh,
>
> > > Use following-
>
> > > viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
>
> > > On Apr 17, 3:14 pm, Rakesh <rakesh_n...@yahoo.com> wrote:
>
> > > > Person.getField always returns null for any parameter that I pass to
> > > > the method. Could someone reason it out please?- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -

rana das

unread,
Apr 17, 2008, 7:16:11 AM4/17/08
to opensoc...@googlegroups.com
ve u worked on shinding container ?
and i am trying to access my profile only .......
but i am not getting the way ........
can u help me out......

regards,
rana

Grigolon

unread,
Apr 17, 2008, 9:19:24 AM4/17/08
to OpenSocial - OpenSocial Application Development
Rakesh, let's work first with the PROFILE_URL field.
First you have to create a param to add a request for PROFILE_URL,
like this:

var param = {};
param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.PROFILE_URL];

Then you use:

req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS,
param),
'viewerFriends');

Now, to return all friends, you have to change the MAX filter param.
Use this:

var param = {};
param[opensocial.DataRequest.PeopleRequestFields.MAX] = 900;

Now you can use both param to create your request:

var param = {};
param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.PROFILE_URL]; // return the correct links for
profile url
param[opensocial.DataRequest.PeopleRequestFields.MAX] = 900; // set a
new value to MAX filter (default is 20)

If you have any more questions, please let me know.

On Apr 17, 8:16 am, "rana das" <ranaraj1...@gmail.com> wrote:
> ve u worked on shinding container ?
> and i am trying to access my profile only .......
> but i am not getting the way ........
> can u help me out......
>
> regards,
> rana
>

Rakesh

unread,
Apr 18, 2008, 12:06:37 AM4/18/08
to OpenSocial - OpenSocial Application Development
Thanks Grigolon... That works just fine...
Regarding FetchPeopleRequest, does the APIs provide some way to fetch
the records a few at a time rather than fetching all in one go?


On Apr 17, 6:19 pm, Grigolon <egrigo...@gmail.com> wrote:
> Rakesh, let's work first with the PROFILE_URL field.
> First you have to create a param to add a request for PROFILE_URL,
> like this:
>
> var param = {};
> param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
> [opensocial.Person.Field.PROFILE_URL];
>
> Then you use:
>
> req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIEN­DS,

Meenu gupta

unread,
Apr 18, 2008, 12:10:20 AM4/18/08
to opensoc...@googlegroups.com
Rakesh,

You can use following for fetching first 20 records of friends-
params[opensocial.DataRequest.PeopleRequestFields.FIRST] = 20;

Rakesh

unread,
Apr 19, 2008, 11:41:02 AM4/19/08
to OpenSocial - OpenSocial Application Development
I am getting an error in newFetchPersonRequest when I pass a userId to
the request. See code below
I am perfectly getting the friend id in "e.id" but in call back
function dataResponse.hadError() is true and var friend is null
Could you explain this please?

function OnClickFriend(e)
{
var req = opensocial.newDataRequest();
var param = {};
param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.ALL];
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),
'viewer');
req.add(req.newFetchPersonRequest(e.id), 'singleFriend');
alert(e.id);
req.send(OnLoadSingleFriend); };

function OnLoadSingleFriend(dataResponse)
{
alert("callback");
var friend = dataResponse.get('singleFriend').getData();
alert(dataResponse.hadError());
alert(friend);
document.getElementById('friendDetails').innerHTML =
friend.getDisplayName();

wessel...@googlemail.com

unread,
Apr 20, 2008, 5:34:47 AM4/20/08
to OpenSocial - OpenSocial Application Development
I have the problem to retrieve the the profile url for an owner using
newfetchpersonrequest and within
as optional paramters :

var param = {};
param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.PROFILE_URL];

but in the response function i am trying to get then the profileurl
by :

var owner = dataResponse.get('owner').getData();
var profileurl = owner.getField(opensocial.Person.Field.PROFILE_URL);


... but it doesnt work why???

marc.
Reply all
Reply to author
Forward
0 new messages