I'm developing an app in which the user needs to search and select a person from Facebook. I'm able to search in the Facebook Graph API using "https://graph.facebook.com/search", however this only give very general results and not the 'close' people Facebook would normally suggest when searching in the search field on Facebook.com. In this case it is impossible to find someone with a regular name.
Does anybody know how I can personalize my query or go around this problem?
The Graph API search is not the same nor directly comparable to the search in the Facebook website.
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#search
Related
I'm trying to replicate some functionality of the Facebook web interface via the API and am a bit stuck. Basically, via the web site I can enter 'Favorite pages of people named "jim"' in the search box and get a slew of results, but I haven't found a way to replicate this type of query via the API. Is such a thing possible?
As WizKid commented, Graph Search is not available with the API, you can only use the Search API for searching: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1#search
Keep in mind that public search and news feed search are not available in v2.0 anymore, see changelog: https://developers.facebook.com/docs/apps/changelog
The new graph search on facebook page allows you to search for current employees of a company by typing a query like "Current Google employees" on the top search bar.
Now how to do the same via Graph API? Or if not possible via Graph API, then I am thinking of scrapping it using say, Scrapy, but then it redirects me to the login.php page. Any help would be appreciated.
Thanks
It's not possible via Graph API based on how permissions and privacy in the API work.
I am not rolled out to Graph Search but I'm guessing each query has a specific page and you can use Scrapy to pull it. The reason you are being redirected is because you don't have the proper headers and cookies (such as dtsg and datr) to see the page. You need Scrapy to impersonate the user of the page.
Though, it wouldn't make sense building an application like this. The whole point of the API is so that you don't scrape pages without their permission. This sounds like a sure way to ask for a cease and desist once you usage is noticable.
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).
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).
I am using the Facebook graph API with queries like:
https://graph.facebook.com/search?q=term&type=post&access_token=XXXXXXXXXX
but I am getting different results when I execute a query via graph API and via the Facebook web...
I am using the same user (I get a access_token from the same user that I uses to search via web).
I tested this text query with dif. browsers and with a java client and I have the same problem....
I was searching information about this topic, but It was impossible to find something.
Finally, I'd like to ask if someone know how this query customizes its results and if it is possible to parametize it.
Regards.
Update:
I am testing a query as:
https://graph.facebook.com/search?q=mark&type=user&access_token=XXXXXXX
but I don't receive results. I don't understand how it is possible which Facebook doesn't find users named Mark..... I suppose I have to use some parameter (fields, f.e)... But It is not explained in the documentation....