0

Why is location info not returned for a profile request?

When requesting the OWNER profile with the JS Open Social API, I do not get any location info back. According to the docs it should be there: (http://developer.yahoo.com/yap/guide/os-supp-features.html#datarequest)

I am explicitly requesting it:

CODE
var req = opensocial.newDataRequest();

var opt_params = {};
var req = opensocial.newDataRequest();
opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.PROFILE_URL, opensocial.Person.Field.ADDRESSES
, opensocial.Person.Field.ABOUT_ME];
req.add(req.newFetchPersonRequest('OWNER'
, opt_params), 'myOwner');
req.send(onLoadProfile);


But it's not in the response:
CODE
[{"id":"myOwner","data":{"gender":"male","profileUrl":"http://profiles.yahoo.com/u/ELVTDDVUCWPZ7KUQ7GGXIDWU5E","id":"ELVTDDVUCWPZ7KUQ7GGXIDWU5E","name":{"formatted":"David V","familyName":"Veksler","givenName":"David"},"thumbnailUrl":"http://a323.yahoofs.com/coreid/4ac84d69i1e99zul1sp1/8tagMbgya7Ie9ChibnUUIxQ-/105/t192.jpg?ciAAToMBX44y17vw","urls":[{"value":"http://profiles.yahoo.com/u/ELVTDDVUCWPZ7KUQ7GGXIDWU5E","type":"profile"}],"photos":[{"value":"http://a323.yahoofs.com/coreid/4ac84d69i1e99zul1sp1/8tagMbgya7Ie9ChibnUUIxQ-/105/t192.jpg?ciAAToMBX44y17vw","type":"thumbnail"}],"displayName":"David V"}}]

by
4 Replies
  • Hi David,

    The reason for the missing location is because the field that you will need to request within profile details is CURRENT_LOCATION (noted here: http://code.google.com/apis/opensocial/doc...RRENT_LOCATION).

    Here's an example of collecting the location of the user. I just ran this code base just to verify that it works correctly and I saw my location in the response:

    CODE
    var req = opensocial.newDataRequest();

    var opt_params = {};
    var req = opensocial.newDataRequest();
    opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
    = [opensocial.Person.Field.CURRENT_LOCATION];
    req.add(req.newFetchPersonRequest('OWNER', opt_params), 'myOwner');
    req.send(onLoadProfile);


    Hope that helps. If you still can't see the location I would just make sure that it is entered into the user profile at profiles.yahoo.com

    - Jon
    0
  • OK, I see the location now.

    I am having a little trouble getting the value. This is what I tried:

    CODE
    var sLocation = person.getField(opensocial.Person.Field.CURRENT_LOCATION).getField(opensocial.Address.UNSTRUCTURED_ADDRESS);


    getField(opensocial.Person.Field.CURRENT_LOCATION) is an object, but the UNSTRUCTURED_ADDRESS is undefined.
    0
  • QUOTE (Jonathan LeBlanc @ May 21 2010, 09:19 PM) <{POST_SNAPBACK}>
    Hi David,

    The reason for the missing location is because the field that you will need to request within profile details is CURRENT_LOCATION (noted here: http://code.google.com/apis/opensocial/doc...RRENT_LOCATION).

    Here's an example of collecting the location of the user. I just ran this code base just to verify that it works correctly and I saw my location in the response:

    CODE
    var req = opensocial.newDataRequest();

    var opt_params = {};
    var req = opensocial.newDataRequest();
    opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
    = [opensocial.Person.Field.CURRENT_LOCATION];
    req.add(req.newFetchPersonRequest('OWNER', opt_params), 'myOwner');
    req.send(onLoadProfile);


    Hope that helps. If you still can't see the location I would just make sure that it is entered into the user profile at profiles.yahoo.com

    - Jon
    0
  • Nevermind, I figured it out:

    CODE
    var sLocation = person.getField(opensocial.Person.Field.CURRENT_LOCATION);
    var sAddressUnstructured = sLocation.getField('formatted');
    0

Recent Posts

in Social Directory API