11 messages in com.googlegroups.opensocial-orkut[orkut-developer] Re: How to get my f...| From | Sent On | Attachments |
|---|---|---|
| Soumya | 24 Jul 2008 06:41 | |
| Guilherme Frisoni | 24 Jul 2008 07:24 | |
| Soumya | 25 Jul 2008 00:19 | |
| Guilherme Frisoni | 25 Jul 2008 05:10 | |
| Jason | 25 Jul 2008 16:27 | |
| Soumya | 28 Jul 2008 01:27 | |
| Jason | 28 Jul 2008 18:21 | |
| michael oliveira | 28 Jul 2008 18:29 | |
| Viveka | 28 Jul 2008 19:13 | |
| Jason | 29 Jul 2008 15:48 | |
| Soumya | 30 Jul 2008 04:48 |
| Subject: | [orkut-developer] Re: How to get my friends email id and country name using orkut application?![]() |
|---|---|
| From: | Viveka (muth...@gmail.com) |
| Date: | 07/28/2008 07:13:57 PM |
| List: | com.googlegroups.opensocial-orkut |
Hi Jason,
DAfOS looks similar to Code Runner. Is there any difference between these two?
Thanks Viveka
On Jul 26, 4:28 am, Jason <apij...@google.com> wrote:
Hi Sournya. As Guilherme mentioned in his first post, you can only get the addresses for friends who have the application installed. For friends who don't have your application installed, the addresses object will be null, which explains the error you're receiving.
Guilherme showed you how to filter the list of friends to request only those who have the app. Just add this line before sending the request:
params[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.HAS_APP;
I tested this with the Developer Application for OpenSocial (DAfOS) and was able to get the addresses of my friends who also had DAfOS installed. (By the way, if you haven't heard of it, DAfOS is an invaluable development tool which you can use to quickly test JavaScript snippets. I've included the URL below).
http://sandbox.orkut.com/AppInfo.aspx?appId=845795770537
Cheers! - Jason
On Jul 25, 5:10 am, "Guilherme Frisoni" <fris...@gmail.com> wrote:
Hi Soumya,
I tried your code and it's correct. But opensocial don't retrieve address from your friends list. I can't find any reference in API documentation about this, will search again later. I'm almost sure you can get address only from viewer.
Frisoni
On Fri, Jul 25, 2008 at 04:19, Soumya <dumm...@gmail.com> wrote:
Hi Frisoni,
Many many thanks for your kind help.
Here is my code. I am not able to get any country name as addresses.length is null. Please help me to get rid of this issue. Thanks in advance......
<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Friends"> <Require feature="opensocial-0.7"/> </ModulePrefs> <Content type="html"> <![CDATA[ <script type="text/javascript"> function init() { var params = {}; params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100;
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.ADDRESSES]; var req = opensocial.newDataRequest();
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS, params), 'viewerFriends'); req.send(onLoadFriends); } function onLoadFriends(data){ var viewerFriends = data.get('viewerFriends').getData(); viewerFriends.each(function(person) { var addresses = person.getField(opensocial.Person.Field.ADDRESSES); //alert(addresses.length); var country = addresses.getField('country'); alert(country); }); } gadgets.util.registerOnLoadHandler(init); </script> ]]> </Content> </Module> On Jul 24, 7:25 pm, "Guilherme Frisoni" <fris...@gmail.com> wrote:
Hi Soumya,
You need to mahe opensocial requests to get this infos, but I think you won't be able to get friends email, and friends address you will get only from those friends that have your application installed. Maybe Jason can confirm this information for you.
The code to retrieve country will be like this:
var viewer_friends; var req = opensocial.newDataRequest(); var opt_params = { }; opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.ADDRESSES]; opt_params[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.HAS_APP;
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS,
opt_params), "viewer_friends"); req.send(function get_callback(response) { viewer_friends = response.get("viewer_friends").getData(); viewer_friends.each(function(person) { var addresses = person.getField(opensocial.Person.Field.ADDRESSES); var country = addresses[0].getField('country'); // addresses return an array, with [0] you get first address (can be many) } ); } );
Hope this can help you, Frisoni
On Thu, Jul 24, 2008 at 10:41, Soumya <dumm...@gmail.com> wrote:
Hi all,
I am trying to build an application where all of my friends' country name and email id are required. I am just a beginner of open social application. Please help me to get it done.
Thanks is advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Orkut
Developer Forum" group.
To post to this group, send email to open...@googlegroups.com
To unsubscribe from this group, send email to
open...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---




