Facebook Graph API - Typeahead-like User Search - facebook

Using the search API here: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1
I've noticed a big discrepancy between searching for a name using that API and searching for a name in the typeahead box at facebook.com. I imagine part of it is that the typeahead results are weighted using social relevancy like: http://thenextweb.com/facebook/2013/11/10/script-shows-facebook-ranks-friends/
I don't believe it's possible to do an API call like that, but is it possible to do an approximation? I tried ordering by mutual friends using FQL (like this question asks: FQL, search for non-friend people and sort by mutual friends) but the results seem to be too truncated.
Region/city targeting may be useful, but ideally I'd like to a way to do an accurate search without having to specify that.

Related

Facebook graph api search displaying users in Facebook but not in graph [duplicate]

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.

Facebook Graph api users search

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.

Facebook Graph Search

Facebook's graph search is indeed a great way to find people with certain interests, activities, etc.
However, some queries that work well within Facebook's search interface have failed with the API.
Those queries include:
- People who like tennis.
- People who checked in at Heathrow Airport.
- People who work at Facebook.
This is how I wrote the query:
https://graph.facebook.com/search?q=people+who+like+tennis&type=user
I want to return all the user objects that match the query "people who like tennis".
Is this possible or is the Graph API just limited to simple one word queries?
Thanks!
this is not possible with the Graph API search. Have a look at
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1#search
to see what is possible concerning Graph API search.
Graph Search that you use on Facebook.com and the Graph API search that you use using the API are two completely different things. There are no API for Graph Search.

Finding the list of all users who attended a particular college using fql

I want to find the list of all facebook users who attended a particular college using fql.
Is that possible?. If yes then, how do I write that query?.
It appears that this is not possible, looking both at FQL and the Graph API documentation. I don't even believe there's an easy way to get a list of fans of the page. The most obvious reason for them preventing this is to prevent marketers from getting lists full of personal information to use for sending promotions or offers (spam).

How to use Facebook api to search for users

As the title says i want to search with Facebook Api (Graph Api or FQL, that doesnt matter, or even REST) for users.
For example: I want to search for "Britney Spears" and i want to get all users with that name (like %search%).
The result should be like http://www.facebook.com/search/results.php?q=britney%20spears&init=quick&tas=0.8058435615324403&type=users
you can use the search API from the Graph API for a particular user like this:
People: https://graph.facebook.com/search?q=USER_NAME&type=user
If you want to search for a list of users, you can you this:
SELECT uid, username, name, pic_square FROM user WHERE contains("Joe Biden")
Refer official user table docs to see all the fields you can query
But the CONTAINS() function is known to be mysterious and no one from facebook has clarified it yet. It might work in some cases and others it might not.
see thread: Documentation for CONTAINS() in FQL?
I guess the final answer would be that you cannot replicate the facebook search functionality like the site does (searching all users of a given name). You can only search users related to the current logged in user who is using your app since these are the type of social apps that facebook wants developers to build. They want you building apps that provide value to their users by utilizing their social graph of their friends and relatives. Developers don't need site wise search for this I suppose, hence there is no API to do this (yet).