0

Retrieval of OpenSocial Connections

Hi,

I am developing an application that has a function to send their connections(contacts/friends) a message. I have followed the YDN's example that can be found at http://developer.yahoo.com/yap/guide/caja-ready-code-exs.html#wall_to_wall_app

However, I am having difficulties retrieving connections.

I'm currently using OpenSocial 0.9, with my app hosted on PHP Fog. I'm not sure if PHP Fog or Yahoo! has any limitation on those APIs/used. I have also successfully verified the domain.

Please advice. Thanks!


- Patrick

by
2 Replies

  •  
    • Enter Your Code Here
    0
  • Do you want to get the list via JS, or PHP? I would strongly recommend using YQL for getting the list. There is an PHP SDK for YQL but the JS is very simple.
     
    function GetMyFriends (fnCallback) {
    var params = {},
    urlYQL = "SELECT guid, yid, name.nickname, name.givenName, name.familyName, image.imageUrl FROM yap.messenger.buddy(0) WHERE guid=me";
    params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
    params[gadgets.io.RequestParameters.POST_DATA] = "";
    gadgets.io.makeRequest("http://query.yahooapis.com/v1/yql?q="+encodeURIComponent(urlYQL)+"&format=json", function(o) {
    var response = gadgets.json.parse(o.text);
    if (response.query && response.query.count) {
    console.log("Friends recieved successfully!");
    if (fnCallback) window[fnCallback](response.query.results.contact);
    } else console.log("Error: "+response.error.description);
    }, params);
    }
    yap.messenger.buddy(0) has the most complete collection of  contacts and connections. Other tables will give you either of contacts or connections and not both.
    0

Recent Posts

in YAP