Hum... Strange. It was working yesterday (I think. It was saturday night. I
may not remember everything), and now, it's not.
owner is still returning correct id, but data.get("viewer").getData() is
returning empty.
var owner = data.get("owner").getData().getId();
var viewer = data.get("viewer").getData().getId();
Alex.
On Sat, Jul 3, 2010 at 9:08 PM, Alex Porto <[email protected]> wrote:
> Hi Robson!
>
> It worked! I'm gonna try the opensocial-templates tomorrow, but the id
> requests are working now.
>
> Thank you!
>
> And my regards to any group members from Argentina :-)
>
> Alex.
>
> On Sat, Jul 3, 2010 at 7:06 PM, Robson Dantas <[email protected]>wrote:
>
>> Try this, and let me know how it goes:
>>
>> function callData() {
>>
>> var req = opensocial.newDataRequest();
>> req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER),
>> "viewer");
>> req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),
>> "owner");
>> req.send(onRequest);
>> }
>>
>> function onRequest(data) {
>>
>> var owner = data.get("owner").getData();
>> var viewer = data.get("viewer").getData();
>>
>> alert(owner.getId());
>> alert(viewer.getId());
>>
>> }
>>
>> The owner id is different from uid. It's ok.
>>
>> Robson Dantas
>>
>> 2010/7/3 Alex Porto <[email protected]>
>>
>>> Gentlemen,
>>>
>>> I've noticed this issue: I can get viewer and owner id's using
>>>
>>> req.add(req.newFetchPersonRequest("OWNER"), "get_owner");
>>> req.add( req.newFetchPersonRequest( 'VIEWER' ), 'get_viewer' );
>>>
>>> And then, after the request data arrives,
>>>
>>>
>>> function dataAvailable(data) {
>>> var ownerData = data.get('get_owner').getData();
>>> var owner = ownerData.getField( opensocial.Person.Field.ID );
>>>
>>> var viewerData = data.get('get_viewer').getData();
>>> var viewer = viewerData.getField( opensocial.Person.Field.ID );
>>>
>>> However, this code isn't working when the viewer isn't the owner. I.e.:
>>> When I'm watching an app installed on my Orkut account, it return's ok. But
>>> when other users loads the app on my Orkut profile, the viewerData is
>>> invalid. I can catch this by data.hadError(), but data.errorMessage()
>>> returns undefined, as well as viewerData.
>>>
>>> Also, I noticed that the owner Id returned in both cases is differente
>>> from the uid present at Orkut URL.
>>>
>>> Any hint's about that?
>>>
>>> Thank you,
>>>
>>> Alex.
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "orkut Developer Forum" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<opensocial-orkut%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/opensocial-orkut?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "orkut Developer Forum" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<opensocial-orkut%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/opensocial-orkut?hl=en.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"orkut Developer Forum" 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-orkut?hl=en.