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).
Related
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 learning facebook php and javascript sdk. I am trying to create a facebook search friend bar in my app where user types friends name and as user types, the searchbar should display most appropriate result while user is typing. Similar to what facebook search bar does. Is there a social plugin or any other tool available to acieve this task? To achieve this, I tried facebook comments plugin with user_friends permission. When user writes any friends name followed by # sign on comments field, facebook gives most appropriate result. But I dont know how to get what user wrote on comments. Any pointers will be helpful.
FB introduced API versoining. If you are going to create new app it will use version v2 and you will not get full friends list from me/friends.
/me/friends returns the user's friends who are also using your app
In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app. In v1.0, the response included all of a person's friends.There are two key use cases where apps need access to non-app friends: tagging and inviting. In v2.0, we've added the Taggable Friends API and the Invitable Friends API to support these flows.After a person has logged in with v2.0 of Facebook Login, calling /v1.0/me/friends and/v2.0/me/friends` will both result in the v2.0 behaviour - both calls will return the set of the person's friends who also use the app.
Read this documentation
https://developers.facebook.com/docs/apps/upgrading
Either you can create this by yourself (not too much of complex). You have access to the friendlist, so you can get all the friends with /me/friends. You can store them (their name/info) into a variable in your application and implement search. This will make your facebook api concepts better.
Or there are many friend selectors plugin/codes that you can integrate in your application. But you'll have to modify them accordingly since you dont want to show a pre-populated list of friends instead you want to implement search.
I've used mbrevoort's multi-friend selector in my applications.
But if you just want to implement search, implementing on your own would be really easy and less complicated!
I'm trying to use Facebook API to get a list of people who checked into a place.
When typing in the search box in Facebook UI People who have been to THE_PLACE I get a long list containing many people, also people who are not my friends or friends of friends.
However, when I try to get the same information from the Facebook API, I get a list that only contains my friends who checked in. The FQL I used is the following (and also some other variants that didn't do better): SELECT author_uid FROM checkin WHERE target_id = THE_UID_OF_THE_PLACE
Am I doing something wrong or is this simply impossible to get via API the same information I can access through the UI?
For privacy reasons, this is not possible at all. Also, FQL is deprecated. I have answered a similar question here: facebook graph API - get last checked users to place/page
I am using the Facebook Graph API through the Javascript SDK to search for users. However, when I try to find a user that has a protected profile it does not show up in the search results. Which I find weird because if I use the Facebook website to look for the same user using the default search bar, the user DOES show up. Is there any solution to find a user in a better way?
Could you be more specific? How do you search for the users, what users are you searching for? As a general rule, if you need something more than basic information provided by Graph API, you will need user's permissions (as in getting their e-mail address and so on).
I am trying to develop an application on facebook for which i need those friends with whom the user interacts the most on facebook .In short i need a list of top friends of a user. How can i do that.What parameters do i need to look for in the graph api for finding the top friends.
Facebook doesn't provide this information directly per se but it would be pretty easy to use FQL statements to generate this information yourself. Check out the FQL documentation asn you could run queries against the stream table to find user interactions. You could also look at checkin table and album/photo/photo_tag, although these would require more permissions from the user.