Yaron Levi Yaron Levi - 2 months ago 10
C# Question

Get the Friends of my friend using the Graph API

I am trying to do a very basic thing with the new Graph API.

I already know how to get my friends:
"https://graph.facebook.com/me/friends?access_token=4333ed34d..."

But if I have a friend who's ID is 123456, then I want to get his friends :
"https://graph.facebook.com/123456/friends?access_token=4333ed34d..."

But I get an exception:


"The remote server returned an error: (500) Internal Server Error."


Why can't I do that? It's a very trivial task to ask from the API.

Answer

If I try to get friends of a random user I get HTTP 500 but it contains this response:

{
   "error": {
      "type": "Exception",
      "message": "(#604) Can't lookup all friends of <UID>. Can only lookup for the logged in user (<MY_UID>), or friends of the logged in user with the appropriate permission"
   }
}

which is pretty self-explanatory.

If I try to get friends of my friend who allows viewing his other friends it works fine. If my friend chose to not allow viewing his other friends I get the same error.