I need in my application to build a social graph of friends for each user.
Like it is doing the facebook app "Social Graph":
App URL.
As I have seen there is no way to extract the friends of friends besides they are also using the application. So what I was thinking about is to extract the friends and for each pair of friends I can check with friends.areFriends whether they are friends and so build the social graph.
But for a user with 300 friends, I need 45.150 API calls. Which exceeds the API call limit per hour.
So is there a way to cast more queries in an API request. Or any suggestions how I can build this social graph in a better way??
best regards
I would suggest a slightly different approach to doing this. You should store what you can in your data store for quicker querying. You should implement the Real-Time API from Facebook and subscribe to each user's friend requests. This way you can keep track of friendship links to start fleshing out your social graph.
Related
I searched the internet the whole day for this, and came to the conclusion that there is no way to get a user's full friend list since API 2.0 (correct me if I am wrong).
What I want to do is, given the app user and another facebook user, generate a report about their "second level" mutual friends. That is - (friends of mine) who are friends with (a friend of his). Illustration:
Is this kind of thing possible after facebook's restriction since API 2.0 in any platform (Different SDKs, Facebook's Graph API, etc)?
Many Thanks.
This would be the API: https://developers.facebook.com/docs/graph-api/reference/user-context/all_mutual_friends
There is no way to get friends (or users in general) who did not authorize your App. Every list you get will only include users who authorized your App.
I'm using Facebook graph Api to search users and data that i get is kinda different from that i get from Facebook UI. For example search response of User interface is friends, mutual friends and other related data in first. How can i query to get related data for current user ( i.e friends and mutual friends in first place).
Here is query that i'm using to search users.
https://graph.facebook.com/v2.5/search?fields=id,name,picture.type(normal)&limit=50&q={q}&type=user&access_token={token}
and data that i get is kinda different from that i get from Facebook UI
That’s because those are two completely different things.
The search functionality offered via the UI is called Graph Search. But the powerful possibilities that offers are not exposed via API. (To protect user privacy, and keep apps from doing extended user profiling via that data.)
Searching via API is limited to what is listed here: https://developers.facebook.com/docs/graph-api/using-graph-api/#search
That’s not much – but it’s all you get.
I am trying to fetch a particular user's photo using Instagram, lets say one particular sports team, I am unable to proceed further since the API's seem to return images of all users with similar handle? Is there a way around it?
Let me know please.
I am not sure what you're using, but the Instagram API absolutely provides an end-point for an individual user's photos.
Once you've obtained the user's ID you can use the /users/user-id/media/recent and /users/self/feed endpoints as required. What API calls are you currently using, if not those?
I am designing an App for iPhone and I want the user to share my App to his or her best friends. Now I can get user's friendlist throught Facebook Graph API. But how could I find user's best friends? I have an idea that I can use the user's wall to find which friend often appears on the wall. However, some pages and famous people like Obama always appears on the wall. Could someone give a feasible solution?
Define “best friends”, please.
If that is supposed to be something based on the user’s personal perspective at the very moment – then probably best to just let them choose their “best friends” the want to a request to themselves via a simple multi-friend selector.
Or are you referring to a user’s list of “close friends”, the default friend list on Facebook that every user can add friends to? That’s available via API, check the /me/friendlists connection. https://developers.facebook.com/docs/reference/api/FriendList/
Using Facebook's Graph API, I am currently looping through all friends to retrieve their videos, and then present a list of these videos to the user. It obviusly takes a while to do this depending on number of friends,
Is there any way to just say to FQL - give me all videos that I have permsission to view?
Facebook doesn't want applications to be able to "mine data". They don't want applications to be able to collect that much data on anything they want. In most cases an ID must be specified.
User ID
Page ID
Group ID
Event ID
etc...
Even in such a case there is also limitations and multiple calls will have to be made. The limitations themselves are not only limited to accessing data with FQL or the Graph API.
There are also limitations on your access to the API. This is called application throttling and it can be enforced on your application if they find you doing an abnormally large amount of calls to the API. There are also other limitations such as making multiple sequential posts or even duplicate posts to your users.
I'm afraid that the answer is no.
Just playing around with the graph API explorer:
http://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20vid%2C%20owner%2C%20title%2C%20src%20FROM%20video%20WHERE%20owner%3Dme%28%29
I know that to get a list of my friends I can do:
SELECT uid2 FROM friend WHERE uid1=me()
I then updated the video query to:
http://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20vid%2C%20owner%2C%20title%2C%20src%20FROM%20video%20WHERE%20owner%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%3Dme%28%29%29
And now I get a paginated list of all videos belonging to my friends. This one query is certainly better than pounding the API to death with multiple calls. :)