Retrive orkut user id

12 views
Skip to first unread message

spiderjacob

unread,
Nov 13, 2008, 8:06:11 AM11/13/08
to Orkut Developer Forum
hello all, i need your help to retrive the orkut id in orkut app. but
the window.top.location is not working there. is there any other
method for that???

please help...

thanks & regards

jacob

Vijaya

unread,
Nov 14, 2008, 7:08:07 PM11/14/08
to Orkut Developer Forum
You can parse out the orkut uid from the PROFILE_URL field as shown in
the following snippet.
You can paste this code into the dev app
(http://www.orkut.com/Main#Application.aspx?appId=291092957065)
and test it out:

function init() {
var request = opensocial.newDataRequest();
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.PROFILE_URL];

request.add(request.newFetchPersonRequest
(opensocial.IdSpec.PersonId.OWNER, params), 'owner');

request.send(processResponse);
}

function processResponse(data) {
var owner = data.get('owner').getData();
var profileUrl = owner.getField
(opensocial.Person.Field.PROFILE_URL);

var tokenizedUrl = profileUrl.split(/\?uid\=/);

if (tokenizedUrl.length == 2) {
var uid = tokenizedUrl[1];
output(uid);
}
else {
output("Error: user id not found");
}
}

init();

spiderjacob

unread,
Nov 18, 2008, 8:18:31 AM11/18/08
to Orkut Developer Forum
thanks it's working
Reply all
Reply to author
Forward
0 new messages