What's new? | Help | Directory | Sign in
Google
                
Search
for
Updated Feb 14, 2008 by api.kur...@google.com
RequestingDetailedProfileInformation  
How to request profile fields beyond the standard ID, NAME, and THUMBNAIL_URL

Introduction

The OpenSocial API only returns a limited amount of profile information about users by default. To request additional fields, you need to specify the opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS parameter when constructing your request.

For a list of what fields may be requested, please check here.

Details

This example requests the ABOUT_ME and ACTIVITIES fields in Orkut. It uses the CodeRunner output function.

function response(data) {
  var viewer = data.get("viewer_profile").getData();
  var aboutme = viewer.getField(opensocial.Person.Field.ABOUT_ME);
  var activities = viewer.getField(opensocial.Person.Field.ACTIVITIES);

  output(aboutme);
  output(activities);
};

function request() {
  var req = opensocial.newDataRequest();

  var params = {};
  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [
    opensocial.Person.Field.ABOUT_ME,
    opensocial.Person.Field.ACTIVITIES
  ];

  req.add(req.newFetchPersonRequest("VIEWER", params), "viewer_profile");
  req.send(response);
};

request();

Comment by amit.hp3, Jul 02, 2008

i have tried the same code but it still returns null values visit the link http://www.sandbox.orkut.co.in/Application.aspx?uid=5325687833660916649&appId=1028370445473&bpc=1


Sign in to add a comment