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§ion=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...
Related
I'm trying to write some application that scan user's group posts. When I read the group feed posts using the API I’m interested to get some information on the one who posted this post ('from' field). The graph API today gives only the id and the name of this person. I'm interested also in his work place. I tried taking the user id and to access the / resource and to get his work field , but this field is not returned. When I’m looking on the same user profile in Facebook I see his work place is public, even I’m not connected with him.
Anything I can do to get this user work with the existing Facebook API?
Normally, if the work history info is not public, you'll need the "user_work_history" permission (see https://developers.facebook.com/docs/facebook-login/permissions#reference-extended-profile).
If it's public, you can try calling the
/{USER_ID}?fields=id,work
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.
My application is posting on wall on behalf of the user with user access_token. Once it is posted I get back the post_id which is persisted in DB. An an application I would like to query the post using the post_id to collect some basic insights like comments and likes. I can't get my app to query the data.
I tried stream table but doesn't return data as an app. I get "GraphMethodException" code:100
I checked privacy settings on post but that doesn't include permission for an app
I tried GraphAPI /post_id which returns same error as stream table
I tried insights table with post_impressions metric with no luck. I couldn't give the post_id so tried removing the user_id part from post_id(xxxx_yyyy where xxxx is the userid)
What kind of permissions do I need to request user to grant my application stream_read permission?
How do I query insights table with the post_id that I have?
You can only read the user wall with an active user access token, and the read_stream permission.
About the insights: maybe with this graph connection?
/[post-id]/insights
Well, it gives me nothing for a valid post id. But i am sure you can only get the insights of pages, not user accounts.
See here (about pages, but maybe useful additional info): Unable to access a post's insights for someone else's page
One more reason why it will not work, just popped up in my head:
If you go to a facebook page, you have the insights view as admin. Nothing like that on a user profile. So the only thing you can track is how often a link to your app has been clicked after posting it to a user profile. You can easily add tracking information to the link too, so you always know from which profile the click comes.
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.
I'm building a site that allows users to sign in using their facebook account.
I want to cache nice big versions of the users profile pictures. I know that i'm not allowed to cache images for more than 24 hours so i'm going to re-fetch the images once every 24h.
I thought i could get the url of the image original like this:
$fb=new Facebook($key,$secret);
$query = "SELECT src_big FROM photo WHERE pid IN (SELECT cover_pid FROM album WHERE owner = ".$id." AND name = 'Profile Pictures')";
$imgurl = $fb->api_client->fql_query($query);
http://wiki.developers.facebook.com/index.php/Photo_(FQL)
But i get an exception saying "Requires user session". Why do i need a user session? Is there a workaround for this? How does other sites solve this?
If i have a user session it works for some users but not all. Why not?
Rules on photo accessibility are detailed with the Photos.get API method.
Privacy Note: Photos are visible on
the Facebook Platform only if the
photo owner has authorized the calling
application, or the photo owner has
not turned off access to the Platform.
The Photos.get method is essentialy a wrapper for querying the Photo FQL table so it follows the same rules.
Consider asking users for the offline_access extended permission so you can query their own photos even when they're not online. You'll need to store their session key in your database and make queries with that, but it will mean you can pull down the photos of users who have authorised your application whenever you want.
For when it sporadically works: Some users may have set privacy settings to disallow applications access to their profile pics.
Possibly some users might not have uploaded a profile pic.
Edit: From the (new)fb menus go to: Account > Privacy Settings > Applications and Websites > What you Share
(This page explains about how the user's privacy setting choices affect fb-enhanced websites)
In short the external website can only access what fb users have made available to 'Everyone'.