Some facebook friends' birthdays returning as null but I have the correct API permissions - facebook

I'm tring to get my friends' birthdays in my app and some of them are null. I thought that those people don't have a birthday set, but they actually do.
My fql query is:
SELECT uid,name,birthday_date FROM user WHERE uid IN (SELECT uid2 from friend where uid1=me())
The birthdays are also null when I request /me/friends?fields=birthday
My access token has the friends_birthday permission set.
I also tried with birthday instead of birthday_date in the FQL query. Same result.
I imagine that this happens because they opted out somehow, but I don't know how.
Is there an alternate solution to actually get their birthdays from facebook?

It's also possible to remove the ability of apps to access your data when your friends use them, this option will prevent the current session user from seeing some information about their friends via the API, even if that information is accessible on Facebook.com
This setting is in the privacy settings, at https://www.facebook.com/settings/?tab=privacy, under Ads, Apps and Websites -> 'How people bring your info to apps they use' and looks like this:
{edit} you can test this for yourself with test users, it's the most likely reason assuming the birthdays are visible to you in the frontend

These people might have set their Birthdays visible to only themselves or only some restricted friends. This is an option available if we try to edit our Birthday by its side. That can cause it is not available to your query by app.

Related

Get facebook user info

I'd like to know if it is possible to get userid or email for all people with same first name by using FQL and API. I mean all people with first name, like Mary, they don't have be my friends or fans. Thanks.
Not possible.
FB user must give you permission to query their account information. Until then, you can't get any information on them (so of course, you can't query every FB user named Mary).
No. You can't do that.
As Simon said FB user must give you permission to query their account information. An APP can access information for only those users, who have given that permission to the APP.
For example, the apps that you have mentioned in comment, social lead freak etc. will only show the results for those users which have given permission to that particular app. This means that there can be thousands of users on Facebook with the first name "Marry", but out of those thousands of users, only around 200 are using that APP (that is, have given permissions to access their data). Hope that explains the why they are doing that partially.

FQL: privileges to see a friend's posts

I'm trying to get all the posts of a friend with FQL, for some friend, I can retreive all the data needed but with someone other, I get an empty object as response, this is the query:
SELECT post_id FROM stream WHERE source_id=friendID
Knowing that I can actually see the friendID's posts through facebook, I tryed, to get the data through the api, adding a field in whitch use my id as id of the user who is asking for the data
SELECT post_id FROM stream WHERE source_id=friendID AND viewer_id=me()
I also tried this method, advised to me by another user:
SELECT post_id FROM stream WHERE actor_id=friendID AND source_id=me()
None of what i tried works, so, my questions are:
-This friend should grant me access to his data through the api? And how?
-There is an hack to bypass this problem?
-There is a way to understand if the user have 0 posts or I can't see his posts?
Thank you
Actually the problem is that your friend is not allowing apps to bring his info while you can see those data through your facebook account.
Why?
Go to Account Settings then go to Apps settings then select the option Apps other use.
just click here to directly open those settings https://www.facebook.com/settings?tab=applications&section=friends_share&view
You will see a list of categories and most of them are checked (See image below)... so if your friend unchecked the options that he doesn't want apps to access then you will not be able to access the info using an app while, as I said before, you can see these info from your Facebook account.
There is no solution for this because it's a privacy setting your friend prefer...
Note: if your friend added your app then app permissions will override the categories that don't permit the access of apps then queries will return info.
You can check it yourself. Create a temp facebook account and try changing those options and query the stream of your temp account with your main FB account. you will figure it out...

Can't obtain valid Facebook user_online_presence information

This used to work for me before, but some time ago I realised it doesn't work any more. I'm trying to run a FQL query for retrieving user_online_presence status (whether user is available for chat) on facebook. So, my query goes like this:
SELECT online_presence FROM user WHERE uid=userID
where userID is the actual user id on facebook.
But, regardless I'm online or offline on facebook, this query always gives me 'offline' status instead of 'active' (or 'idle').
To reproduce this on your own, simply go to the Graph API Explorer, obtain a token with permission user_online_presence, and type in the box:
fql?q=SELECT uid,online_presence FROM user WHERE uid = me()
I would really appreciate if anybody can help me with this. Thanks!

How to get user's facebook pages and apps list after authentication?

After a user install my application to his/her facebook page,I want to get his/her facebook pages and apps list.
I have read these documents:
http://developers.facebook.com/docs/reference/fql/application/
http://developers.facebook.com/docs/reference/fql/developer/
What is the best way to do?
Another question:
How to check if a user is my app's user?
It sounds like you haven't really looked at the documentation, but they are fairly clear questions, so...
After getting the user_likes permission you can query /me/likes to get a list of pages the user likes. A list of apps is not currently possible in the same way.
A call to /me/permissions or /me/?fields=installed will show if the current app is installed by the current user
A call to /me/accounts with the 'manage_pages' permission will show which pages and apps a user admins, but not which pages and apps they use.
You can use FQL to query this information.
select uid, name, is_app_user from user where uid in (select uid2 from friend where uid1=me()) and is_app_user=1
The user needs to allow (and be user of) your app in order to be able to authenticate though oauth.
You can list the user's pages and apps by accessing:
https://graph.facebook.com/me/accounts
or
https://graph.facebook.com/%user_id%/accounts
But you must also provide the user oauth token.

Getting friends of friends in FB graph API

I would like to get friends of friends via an API call and when I try to do it, I get the following exception,
{
"error": {
"type": "OAuthException",
"message": "(#604) Can't lookup all friends of .... Can only lookup for the logged in user (...), or friends of the logged in user with the appropriate permission"
}
}
The URL I am trying to access is,
https://graph.facebook.com/friend_id/friends?access_token=access_token
I am getting extended permissions which is as follows,
<fb:login-button perms="user_likes,friends_likes"></fb:login-button>
Could any one please let me know what's going wrong here? Or does it mean I can never get access to friends of friends?
Currently, there is no extended permission that allows you to view a user's friends of friends. The "*_likes" permissions just show you the Facebook pages that the users have Liked.
It might be possible for you to iteratively fetch and cache the friends of each of the user's friends, one by one, but without access tokens for each friend, you'll only be able to fetch public data.
I got friends of friends(limited). I had same problem. Though it is very late for answering question, it will help somebody. That's why answering this question.
We can get friends of friends those are app users.
$fb_id= user id whose friends of friends required.
$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) )";
$user_info=$facebook->api(array('method'=>'fql.query',
'query'=>$query));
#Olie:
You are fetching your friends of your friend through application. So you would need permission from your friend whose friends you want. i.e. Your friend should be using that application and accepted those permission while allowing accessing information. Otherwise you wont be able to friends of your friend. I have tested this query. And it works successfully.
"message": "(#604) Can't lookup all friends of .... Can only lookup for the logged in user (...), or friends of the logged in user with the appropriate permission"
This message explains well. Read carefully.
Hope you understand solution criteria.
You cannot get friends of friends, it is not allowed due to privacy concerns.
A workaround we have done before is to save all users friends to oure own database.
That way we could cross-reference all the different users friend-list's and at least get friends of friends who have used the application we made.
Important note, such a table would quickly grow quite seizable depending on the amount of users you get.
Count on each user having about 250-300 friends on average, so if you opt for such a solution make sure to optimize your database for it, and then it should work just great.
Got same problem, had to use old REST API to get at least mutual friends, see
http://developers.facebook.com/docs/reference/rest/friends.getMutualFriends/
You can get the friends of the current user through a Graph API call to me/friends. You will need any valid access_token, no special extended permissions, just the Basic one. There is one caveat, that user must allow you to see their friend list. So in the Privacy Settings > Connecting on Facebook there is a "See your friend list" setting. If the user has chosen a custom setting and selected say "Only Me" you will get this error.
Similarly, if the current user allows others to see their friend list, but one of the friends shuts this down due to privacy concerns then you will not be able to see any data and will get that error.
I was able to verify the scenarios I have described.
Unfortunately, I can't ask your answer specifically since I don't have experience with the FB API. However, I believe that FB allows users to hide who their friends are. If they have this set, then perhaps you won't be able to access their friends at all. I'd try to modify your code to first check what the permissions of a given user are and only then accessing their friends list if you have access to it. A bit of speculation here, though.