FB.ApiClient.friends_get

Description

Return a array of friend ids for the currently logged in user.

Example

Loop through your first 10 friend IDs and put their profile pics in a row. This example uses FB.XFBML.Host.parseDomElement and FB.ensureInit as well as the fb:profile-pic tag.

 <div id="profile_pics"></div>
 <script type="text/javascript">
  var widget_div = document.getElementById("profile_pics");
  FB.ensureInit(function () {
    FB.Facebook.apiClient.friends_get(null, function(result) {
      var markup = "";
      var num_friends = result ? Math.min(10, result.length) : 0;
      if (num_friends > 0) {
        for (var i=0; i<num_friends; i++) {
         markup +=
           '<fb:profile-pic size="square" uid="'
           + result[i]
           + '" facebook-logo="true">'
           + ' </fb:profile-pic>';
        }
      }
      widget_div.innerHTML = markup;
      FB.XFBML.Host.parseDomElement(widget_div);
    });
  });
 </script>

Signature

friends_get(String flid,  Object onRequestCompleted)

Parameters

flidString

(optional) ID of a specific friend list. Pass null for all friends.

onRequestCompletedObject

a callback function for immediate execution, or an instance of FB.BatchSequencer