You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Paulo Ferreira de Moura Jr." <pa...@paulomourajr.net> on 2008/10/02 19:55:42 UTC

Empty data for owner and viewer using opensocial javascript api

I don't know if this is the right list to ask this question; if it's
not, please inform me the right list to post.

I'm using partuza and shindig to develop an opensocial gadget. When I
request owner and viewer information using newFetchPeopleRequest
method, they are always empty, but, strangely, this doesn't happen
with owner friends info.
This is the javascript I'm using to send the request:

    var req = opensocial.newDataRequest();
    req.add(req.newFetchPeopleRequest(opensocial.DataRequest.PersonId.OWNER),
'owner');
    req.add(req.newFetchPeopleRequest(opensocial.DataRequest.PersonId.VIEWER),'viewer');
    req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'),'ownerFriends');
    req.send(onRequestInitInfo);

I've tried also this one:

    var req = opensocial.newDataRequest();
    req.add(req.newFetchPeopleRequest('OWNER'), 'owner');
    req.add(req.newFetchPeopleRequest('VIEWER'),'viewer');
    req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'),'ownerFriends');
    req.send(onRequestInitInfo);


The output of http://shindig/social/rest/rest/jsonBatch seems ok
(extracted using Firebug):

    ({responses: {
owner: {response: {entry: {isOwner: true, isViewer: true, displayName:
"Test 1", id: "1", name: {familyName: "1", givenName: "Test",
formatted
: "Test 1"}, profileUrl: "http://partuza/profile/1"}}},
viewer: {response: {entry
: {isOwner: true, isViewer: true, displayName: "Test 1", id: "1",
name: {familyName
: "1", givenName: "Test", formatted: "Test 1"}, profileUrl
: "http://partuza/profile/1"}}},
ownerFriends: {response: {entry: [{isOwner: false, isViewer: false,
 displayName: "Test 3", id: "3", name: {familyName: "3", givenName:
"Test", formatted: "Test 3"}, profileUrl: "http://partuza
/profile/3"}, {isOwner: false, isViewer: false, displayName: "Test 2", id: "2"
, name: {familyName: "2", givenName: "Test", formatted: "Test 2"},
profileUrl: "http://partuza/profile/2"}], startIndex: 0, totalResults:
"2"}}}, error: false}
);

As you can see, there is a result for owner and viewer. But, when I
use this javascript code:

    var ownerData = data.get('owner');
    if (ownerData.hadError()){
    } else {
       var owner = ownerData.getData();
    }

owner variable is empty. I thought it was a Partuza issue, but after
debugging the shindig code, I've found that the
RestfulContainer.prototype.newFetchPeopleRequest function in
features/opensocial-current/restfulcontainer.js returns an empty
collection in this situation. There is data in rawJson['entry'], but
after me.createPersonFromJson(jsonPeople[i]), people array variable is
empty. I suspect that this is caused by the fact that rawJson['entry']
is not a collection, but a Person object.

Has anybody faced this problem? Is it caused by any misconfiguration?

Regards.

Empty data for owner and viewer using opensocial javascript api

Posted by "Paulo Ferreira de Moura Jr." <pa...@gmail.com>.
Hi,

I don't know if this is the right list to ask this question; if it's
not, please inform me the right list to post.

I'm using partuza and shindig to develop an opensocial gadget. When I
request owner and viewer information using newFetchPeopleRequest
method, they are always empty, but, strangely, this doesn't happen
with owner friends info.
This is the javascript I'm using to send the request:

   var req = opensocial.newDataRequest();
   req.add(req.newFetchPeopleRequest(opensocial.DataRequest.PersonId.OWNER),
'owner');
   req.add(req.newFetchPeopleRequest(opensocial.DataRequest.PersonId.VIEWER),'viewer');
   req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'),'ownerFriends');
   req.send(onRequestInitInfo);

I've tried also this one:

   var req = opensocial.newDataRequest();
   req.add(req.newFetchPeopleRequest('OWNER'), 'owner');
   req.add(req.newFetchPeopleRequest('VIEWER'),'viewer');
   req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'),'ownerFriends');
   req.send(onRequestInitInfo);


The output of http://shindig/social/rest/rest/jsonBatch seems ok
(extracted using Firebug):

   ({responses: {
owner: {response: {entry: {isOwner: true, isViewer: true, displayName:
"Test 1", id: "1", name: {familyName: "1", givenName: "Test",
formatted
: "Test 1"}, profileUrl: "http://partuza/profile/1"}}},
viewer: {response: {entry
: {isOwner: true, isViewer: true, displayName: "Test 1", id: "1",
name: {familyName
: "1", givenName: "Test", formatted: "Test 1"}, profileUrl
: "http://partuza/profile/1"}}},
ownerFriends: {response: {entry: [{isOwner: false, isViewer: false,
 displayName: "Test 3", id: "3", name: {familyName: "3", givenName:
"Test", formatted: "Test 3"}, profileUrl: "http://partuza
/profile/3"}, {isOwner: false, isViewer: false, displayName: "Test 2", id: "2"
, name: {familyName: "2", givenName: "Test", formatted: "Test 2"},
profileUrl: "http://partuza/profile/2"}], startIndex: 0, totalResults:
"2"}}}, error: false}
);

As you can see, there is a result for owner and viewer. But, when I
use this javascript code:

   var ownerData = data.get('owner');
   if (ownerData.hadError()){
   } else {
      var owner = ownerData.getData();
   }

owner variable is empty. I thought it was a Partuza issue, but after
debugging the shindig code, I've found that the
RestfulContainer.prototype.newFetchPeopleRequest function in
features/opensocial-current/restfulcontainer.js returns an empty
collection in this situation. There is data in rawJson['entry'], but
after me.createPersonFromJson(jsonPeople[i]), people array variable is
empty. I suspect that this is caused by the fact that rawJson['entry']
is not a collection, but a Person object.

Has anybody faced this problem? Is it caused by any misconfiguration?

Regards.