I have used a fql for get my friends information
SELECT uid,name,first_name,middle_name,last_name,pic_square,hometown_location,current_location,profile_url,email,website FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
it returning only friends id an name. Who have trusted my app there location also comming but when I am puting this fql on the Graph API Explorer
on facebook then it returns every one's location. Then How Can I get every one's location ?
It is hard to understand your question, though it looks like your app doesn't have all the required user permissions. The Graph API explorer, or the developer page are great resources to figure out which ones you need.
Hometown location,current location, email, and website are not "basic" data.
Related
I am working in facebook Application MVC 4 c# SDK 6
is there any way to get the list of all Facebook User. Either friend or not, who lives in California using Facebook Query Language
List of your friends who live in California and have it list in their current location.
SELECT name, current_location
FROM User
WHERE uid IN (SELECT uid2 FROM Friend WHERE uid1 = me())
AND current_location.state = "California"
Test out the query here.
I don't think it's possible to pull this information on all Facebook users since the location column is not indexed. This answer does a good job explaining why searching by location along is not possible.
Helpful links:
how to write an fql query to list friends in a particular location
From FQL we want to get users current location in php
The one word answer is No. But you can get access to users that have made their location public.
see similar question Facebook API: can I get detailed info about user's location?
I want to get friend app user with Graph API I tried to user with me/friends?fields=installed but I got all of my friends. Maybe, I have some wrong in here. Please show me any way to get friend app user with Graph API. I don't know in Facebook SDK 3.0 can I get that list easier?
You can get list of friends whom are user of your app using FQL rather than Graph API as:
SELECT uid FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND is_app_user = 1
My web app builds a batch request to the Facebook graph API. The batch is composed by making a first API call to grab the user's friends. Then I loop over the list of friends and add a specific request for each (with that user's specific access token) and add each one to the batch. So it ends up being two API calls. Unfortunately, it's REALLY slow, and I've heard the FQL requests are faster.
So my question is, can I do this with FQL? I've read the documentation but I can't figure out how I might return, for example, all the friends of friends' work history (which requires each friend's access token) with one single FQL query. Is this possible? Obviously I could build a batch request of FQL requests, but that would leave me back where I started.
UPDATE:
I've done some tests and FQL definitely seems to be faster than a batch request. My FQL multiquery looks like this:
$multiQuery = array(
"query1"=>"SELECT uid2 FROM friend WHERE uid1 = me()", //LIST OF FRIEND IDs
"query2"=>"SELECT uid, name, work, education, is_app_user FROM user WHERE uid IN (SELECT uid2 FROM #query1)", //FRIEND PROFILES
"query3"=>"SELECT uid2 FROM friend WHERE uid1 IN (SELECT uid FROM #query2 WHERE is_app_user=1)",
"query4"=>"SELECT uid, name, work, education FROM user WHERE uid IN (SELECT uid2 FROM #query3)"
);
$multiQueryResult = $facebook->api(array(
'method' => 'fql.multiquery',
'queries' => $multiQuery
));
var_dump( $multiQueryResult );
The query works but there are two problems:
query3 returns all the user ids, NOT just the ones who've authorized
my app.
query4 doesn't return the work/education fields... presumably
because the API request is being called with the current user's
access token (as opposed to that of specific user from query3). I've stored the authorized users' access tokens in the DB, but I don't know if it's possible to use them in this context.
CAN this be done with FQL?? Can I define unique access tokens within an FQL multiquery?
all the friends of friends' work history (which requires each friend's access token)
If you need different access tokens, then obviously there’s no way of doing it in one single request … but where would you get each of my friends access tokens anyway, if they wouldn’t have interacted with your app themselves recently? And if they would have, you could’ve gotten their work info then already and put it into your own database, so that you could get it from there just using the uids of my friends for lookup. Otherwise, I think this is not really your way to go.
It’d rather be this way:
If friends of your user have set up their privacy settings so that they are willing to share their work info with apps your user is using, then you can get that info without requiring an individual access token for each one of those friends. Then you would just do an FQL query like this,
SELECT uid, name, work FROM user WHERE uid IN
(SELECT uid1 FROM friend WHERE uid2 = me())
That’ll give you your user’s friends work info – but obviously only for those that are willing to share that info with apps a friend is using.
This isn't really an answer to my original question because there doesn't appear to be one. It seems that at the time of writing this, the Facebook batch request is just really slow... which is too bad since that basically defeats its entire purpose.
I am attempting to pull the current location of all of a user's friends on facebook, and am running into a curious problem wherein some of those friends are reading out NULL when I can see on their actual Facebook pages that it says "Lives in ,." The difficult part of this error is that it only happens on probably ~30% of cases. On the remaining cases, it pulls all of the correct information, which tells me that the permissions are probably set up correctly.
To be specific, the FQL code I am using is:
SELECT uid,
name,
current_location
FROM USER
WHERE uid IN (SELECT uid2
FROM friend
WHERE uid1 = Me())
This same issue has arisen when making javascript requests directly to the graph, so it doesn't appear to be an FQL issue either. Does anyone know why current_location might sometimes fail and report NULL, but not always?
Thank you.
Privacy settings have a higher priority than facebook api's.
If user has restricted particular info from privacy setting, you wont be able to fetch that by facebook api's (graph, fql, rest api) even if user grants permission for that.
e.g.
If I have restricted to share my birthday on privacy setting, no app would be able to grab my birthday even if they ask for it.
Also, user can restrict apps from getting particular info.
e.g. User can allow app xyz to access everything they want but at the same time user can restrict app xyz to access his location
I hope this answers your question.
There are 2 possibilities;
The friends of the user who have current_location null :
1) Did not specify their current location in their facebook profile
2) They specified the current location in their facebook profile but
their privacy setting denies you to see it
I have the same problem.
I've checked two different users which are friends of me.
In both cases FQL query like:
select uid, first_name, name, birthday, birthday_date, current_address, current_location, hometown_location, sex from user where uid in (select uid2 from friend where uid1 = me()
returns null for home_location.
I'd checked both accounts and home location was accessible for all (both privacy and app privacy settings).
My access token included all required permissions (home location was shown for other friends).
Then I run FQL console with query:
select uid, first_name, name, birthday, birthday_date, current_address, current_location, hometown_location, sex from user where uid = nnnn
as owner and the results were:
Owner got home location.
On my old FQL Console browser tab -- still no home location.
On my new FQL console browser tab -- I got home location.
After a while I got home location on old FQL console.
But old queries still didn't return home location...
Seems like some caching problem on FB side.
Same issue here. I can retrieve current_location or hometown_location for NONE of my friends. For most of them I can easily see it by visiting their profile though. App permissions friends_location and friends_hometown are set.
Try this query to get current location of your friends
SELECT first_name,uid, last_name, current_location.name
FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND current_location
Also u will need friends_location permission to run this query
I am trying to get a list of my friend's friends using the iPhone Facebook SDK.
I've tried an approach using FQL and the Graph API but I get an error in both cases:
"Can't lookup all friends of YYYYYY. Can only lookup for the logged in user (XXXXX), or
friends of the logged in user with the appropriate permission"
I've done some research and see that this functionality wasn't available through the Facebook API up until October 2010. But then radio silence. Well, it's almost 6 months later. So was this ever implemented?
I have requested all permissions I need for my app as well.
This functionality does not exist in the Facebook Social Graph API or the FQL API.
During my quest to find out how to accomplish this I found many developers who asked the same question. Some developers have been asking for this feature for over 2 years. I think the FB team may consider it a privacy of performance concern.
I have worked on it. I was able to see friends of my friend.
It needs following requirements:
Your friend needs to be using application.
Permission from application read_stream, publish_stream, publish_checkins.
Try this fql query.
$query="SELECT uid, name, work_history FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 IN
( SELECT uid FROM user WHERE uid IN
(SELECT uid2 FROM friend WHERE uid1 = $fb_id ) and is_app_user=1)
)";