How do we search for a user by name within user's friends list. I"m able to fetch whole friends list using this api...
"https://graph.facebook.com/v2.9/#{facebook_id}/friends?access_token=#{access_token}"
But I'm not sure how do we query within friends list? Does Facebook support that?
Some SO answers says to fetch the whole friends list and search within the list ourself but I guess this may not be the right solution as users friends might grow we can't cache our result anywhere and fetching whole list every time also would not be a efficient solution. Does anyone knows any other work around?
Please guide me in right direction.
Thanks.
Related
Good Morning
I would like to find a person on Facebook with the following algorithm:
typing the given name of this person in the search bar, because that is all I know
going through the profile pages of every person in the search result list
opening the friend list of these people one-by-one (if public)
then check if they are friend with one specific person (mutual friend)
Is it possible to automate this process, if then, how?
So basically I just want to know which person from the search result list has this mutual friend on his friend list. This is necessary because the friend list of the mutual acquaintance is hidden.
Your kind help would be much appreciated!
This is not possible for 2 reasons:
Scraping is not allowed on Facebook, you MUST use the Graph API - if there is no way with the Graph API, don't do it.
Users (and friends) are not available in any way if they did not specifically authorize your App - for privacy reasons. You can only get friends of users who authorized your App too.
I want to get the list of all users from a particular place by using the Facebook Graph API. The Link I have used is
https://graph.facebook.com/search?q=rasulgarh&fields=name,id&limit=2000&type=place&access_token=
But this returns the groups only with the location as "rasulgarh". I am not able to get the users. Any help on this would be appreciated.
Your logic is incorrect. Keep in mind that the type parameter is the OBJECT_TYPE. Searching for type=place will return place objects, not user objects. I don't think its currently possible to search for users in a location (that I am aware of, at least.).
Given a place, like https://graph.facebook.com/112088822180423, how can I get the number of likes just by my friends? The graph gives me Likes, Checkins and Talking_About_count, but I just want whose likes by my friends. Is that possible?
If you want to do this for a page you administer and you want do this as an admin, it may not be possible with current API. From https://stackoverflow.com/a/6737579/121052, you cannot get the list of likes for a location or a page. If you had the list, you can fetch a list of your own friends, and then performed an intersection.
However, if it is a feature you are building in an App to be used by it's users - i.e you want to display the list of friends of the user who has liked a page, then that is possible. For that, do the following:
Use http://developers.facebook.com/docs/reference/api/user/#likes to get if the user likes a page/location.
Use http://graph.facebook.com/USER/friends?access_token=XXX to get the list of his friends.
For any friend, you can perform the like check again and make the intersection.
I am sure there might be a way to optimize this operation. Batch Requests will definitely help.
I discovered that this is possible through the use of FQL and the page_fan table
Using GraphAPI, I see you can request location of a specific friend, or search for friends by criteria.
However, I couldn't find a way to search for friends in my area. I want to perform a search and get a results of friends who are in a radius of X meters from me.
I know I can fetch each friend manually and check its location, but it seems a bit inefficient so I'm looking for a batch search,
EDIT: I've found a similar question (and answer) using FQL: facebook fql query similar to friends checkins
Well, you partly answered yourself there...
When you query about a user friend, you get his location as well since it's part of the User object (assuming you have the right permissions of course): http://developers.facebook.com/docs/reference/api/user/
The problem, as you wrote, is that you'll need to send a request to facebook per friend, which is not the right way to go about this.
Thankfully, facebook already thought of that and they came up with the "Batch Requests": http://developers.facebook.com/docs/reference/api/batch/ which let you do exactly that.
EDIT
Now that I think of it, it's simpler than I wrote before, you don't even need the batch requests since you can get all of the user friends in one request to: me/friends.
Assuming you have the user granted you the needed permissions each user object in the friends list will have the location object as well.
For each friend calculate if his location is in the desired radius.
Also, you can retrieve friends location and hometown using this Graph API endpoint: /me/friends?fields=location,hometown,name
But you will need the friends_location and friends_hometown permissions.
Read more: https://developers.facebook.com/docs/reference/login/extended-profile-properties/
I want to know the date that two people became friends. assuming i can get any kind of permissions from the user, is there a way to find this out. I want to be able to calculate how long people have been friends. perhaps friends since a certain time. etc. I cant figure out if this is possible.
no theres no such information in the documented tables of fql and graph api.
you would have to observer the friendslist and mark the time of when a new friend shows up in your own application