当前位置: 动力学知识库 > 问答 > 编程问答 >

How to get friends count of an random user in Facebook?

问题描述:

Is there a way to get the friend count of a random user in Facebook?

I was trying to make a request

at

1579961218908589/friends

on the Graph API Explorer and it always gives me empty data.

网友答案:

If you read the Facebook API documentation for that endpoint, you'll be able to see that retrieving the friends of an user requires that person to enable your app's permission to do so.

So the answer is yes, if you have the permission from the user, or no, otherwise.

If you have the required permissions, then the JSON response will look the same as it does for me/friends.

The response will generally look like this:

{
  "data": [
    {
      "name": "Friend Name", 
      "id": "1579961218908589"
    }, 
  ], 
  "paging": {
    "next": ""
  }, 
  "summary": {
    "total_count": 317
  }
}
网友答案:

I think: no. You're able to get total_count field only for people who uses your application.

Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app. Learn More

分享给朋友:
您可能感兴趣的文章:
随机阅读: