3 messages in com.googlegroups.opensocial-orkutRe: [OpenSocial] First Attempt Help
FromSent OnAttachments
Sree04 Dec 2007 18:50 
Kalyan Lanka05 Dec 2007 02:21 
Sree05 Dec 2007 05:53 
Subject:Re: [OpenSocial] First Attempt Help
From:Kalyan Lanka (kaly@gmail.com)
Date:12/05/2007 02:21:07 AM
List:com.googlegroups.opensocial-orkut

Hi Sree,

Checked your code and after replacing UID with 'VIEWER' Role, it is working fine. Here is the code <?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="People API Howto"> <Require feature="opensocial-0.5" /> </ModulePrefs> <Content type="html"><![CDATA[ <SCRIPT type="text/javascript"> _IG_RegisterOnloadHandler(request);

function request() {

var req=opensocial.newDataRequest();

req.add(req.newFetchPersonRequest('VIEWER'),'viewer'); req.send(response); };

function response(dataResponse) { var viewer=dataResponse.get('viewer').getData(); var name = viewer.getDisplayName(); var thumb = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL); var profile = 'http://sandbox.orkut.com' + viewer.getField(opensocial.Person.Field.PROFILE_URL);

var html = '<img src="' + thumb + '"/>' + '<a href="' + profile + '">' + name + '</a>'

document.getElementById('main').innerHTML = html;

};

</SCRIPT> <div id="main"> </div> ]]></Content> </Module>

Thanks Kalyan

On Dec 4, 2007 9:50 PM, Sree <scho@gmail.com> wrote:

Hello,

Can you please help me! Where do I specify the profile id? How does the sample code below knows which profile I am accessing? I tried replacing the word VIEWER with the sandbox uid but empty results.

Thanks, Sree

<?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="People API Howto"> <Require feature="opensocial-0.5" /> </ModulePrefs> <Content type="html"> <![CDATA[

<script type="text/javascript"> _IG_RegisterOnloadHandler(request);

function request() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("4694083120338855923"), "viewer"); req.send(response); }

function response(data) { var viewer = data.get("viewer").getData(); var name = viewer.getDisplayName(); var thumb = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL); var profile = viewer.getField(opensocial.Person.Field.PROFILE_URL); profile = 'http://sandbox.orkut.com' + profile; var html = '<img src="' + thumb + '"/>'; html+='<a href="' + profile + '" target="_top">' + name + '</a>'; document.getElementById('main').innerHTML = html; }

</script> <div id='main'/> ]]> </Content> </Module>