Hey guys,
Recently, I have been working on integration of weather.com with Facebook via Facebook API calls. One of the challenges I faced is how easily can we get close friends and families without increasing number of calls. The Graph API is so vast and enables us to do it at one shot. It is for sure you can do it by different ways but if you prefer Graph API, this is how you do:
// The following API call gets the list of members from family list and displays in console. FB.api("/me/friendlists/family?fields=members", function(response){ console.log(response); }); // and to get close friends FB.api("/me/friendlists/close_friends?fields=members", function(response){ console.log(response); }); |
As you can see from above, family and close_friends are keywords/id by itself and don’t need the specific group ID. Oh, and don’t forget – you need read_friendlists permission for your APP or you get it in your scope during your login.
If you are a looking at getting both members at one shot, there is always FQL.
FB.api( { method: 'fql.query', query: 'SELECT uid FROM friendlist_member WHERE (flid IN (SELECT flid FROM friendlist WHERE owner=me() and type = "family") or flid IN (SELECT flid FROM friendlist WHERE owner=me() and type = "close_friends"))' }, function(response) { console.log(response); } ); |