views:

139

answers:

3

Hi, 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.

A: 

What language are you using to develop your application? Have you tried catching the exception?

Also, have you acquired the relevant permission from the user?

Martin Bean
I am using C#.I catched the exception and it dose not contain any specific info except from what i mentioned.
Yaron Levi
+3  A: 

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.

serg
Ok i understand , but that is exactly what i do:https://graph.facebook.com/123456/friends?access_token=4333ed34d...123456 is my friend. why can't i get his firneds ???what does it mean "with the appropriate permission" .how can i get a premission from a frinend of my through the API?
Yaron Levi
@Yaron Levi: It must be some setting inside Account > Privacy Settings menu, but not sure which one.
serg
Or maybe when clicking on a pencil icon on a friend list gadget.
serg
A: 

You just can't do that.

If you require the appropriate extended permission when the users authorize your app, you can access some data of the currently logged user's friends, but that's all you get (http://developers.facebook.com/docs/authentication/permissions see: friends_xxxx permissions), but now his/her friends.

agbb
i understand , thank you
Yaron Levi