How to get a list of people who have checked into a place in Facebook - facebook

I'm trying to use Facebook API to get a list of people who checked into a place.
When typing in the search box in Facebook UI People who have been to THE_PLACE I get a long list containing many people, also people who are not my friends or friends of friends.
However, when I try to get the same information from the Facebook API, I get a list that only contains my friends who checked in. The FQL I used is the following (and also some other variants that didn't do better): SELECT author_uid FROM checkin WHERE target_id = THE_UID_OF_THE_PLACE
Am I doing something wrong or is this simply impossible to get via API the same information I can access through the UI?

For privacy reasons, this is not possible at all. Also, FQL is deprecated. I have answered a similar question here: facebook graph API - get last checked users to place/page

Related

Graph API - how meaww and nametests get my friends list without taggable_friends?

I've recently applied for taggable_friends permission and it was denied. I understand that this permission is only for tagging user's friends and if I want to get the user's friends who also use my app, I have to use user_friends.
But I am confused here because, I've recently discovered that a lot of personality test websites can get my friends who doesn't even use ( or used in the past) those apps (i.e meaww.com/activities/question/batman_twin_yours/2355). And the core intention of these personality testing websites are not tagging, just sharing the result in the user's timeline.
I believe the apps of the above mentioned websites, do not have the taggable_friends permission (since they do not ask users to tag anyone) or is of version 1.0.
Is it at all possible that anyone can suggest me how I can get a user's friends' profile pictures and names like those websites?
As #CBroe says: You can't.
I am currently building 'funny' ('bullshit' or 'humoristic' are maybe better terms to describe them) - tests/quizzes and I am trying a workaround:
get a list of the users' (endpoint: /me) -profilepictures. (Requires 'user_photos' permission)
$response = $fb->get('/me/photos?type=uploaded&fields=id,picture.width(800).height(800),link', $accessToken);
Than scan for likes on those pictures.
$response = $fb->get('/'. $tmpId .'/likes', $accessToken);
In the likes are id's and names of users.
It's not a complete friends_list - but if you are like me, OK with just 'some' friends to display something 'useful'...
(With the user_id you get the public profile pic)
Hope I could help!

How to use Facebook api to search for users

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).

Facebook Graph Api json missing posts

I am developing an web app, which connect to facebook, to get posts, and other stuff liked by users. I have problem with getting all posts from user page using news feed(home connection of Grap API).
When getting access token in my app for user, I ask for read_stream, user_activities and offline access permissions. Then, when I use that token, to get json feed for
https://graph.facebook.com/me/home/?access_token=<retrived_access_token>
some posts(which are show on user page) are missing. I found that posts of my friends, which can be seen only by their friends, are not shown in that feed. The same issue is with posts of users which current I am subscribing.
I was searching on that for a while, and I found, that when I use link from http://developers.facebook.com/docs/reference/api/ to get my news feed, there are much more posts. It's seems to use a token generated for test console app for facebook api.
Then I tried to generate access token which would give me similar results using http://developers.facebook.com/tools/explorer?method=GET. But even when I give to generated token all possible permissions I could not get it working good, there were still some missing posts.
I read answer in that post, Facebook graph API does not return all posts for user, which suggested, that this is because of permissions set by my people who publish posts, who don't want their data to be retrieved by an app. I run some quick test, and I found that changing that setting is working( when somebody change that setting her posts will disappear from both feeds - that using my app token for user, and that under link on api reference page), but it's not the case.
It seems that this token generated on api reference page have an special permission.
I really need to get as much posts from user page as possible. I know that I will not get those blocked by their author, but as many of my users subscribe other users I really need to get access to kind of posts shown on user page.
I also read Facebook graph API: feeds missing in json response but it was also not helpfull.
I will really appreciate any help.
It is impossible to get a full list of posts from the feed / home Graph API, but you can use FQL to query the stream table to get almost every post made by friends, here is a quick example of how you would do that with the javascript sdk:
var query = 'SELECT post_id FROM stream WHERE filter_key = "others"';
FB.api('fql', {'q': query}, function(posts) { console.log(posts.data); });
This will get you the post ids, which you can then use with graph api to fetch the rest of the post info. Or you can get the full list of fields here, you can't select * in FQL so you'll have to list each piece you want and then get comments and likes and names separately.
There is an assigned/medium bug on this at http://developers.facebook.com/bugs/228057243915183. You can bump up the priority by subscribing and indicating you can reproduce it.
Also see http://developers.facebook.com/bugs/231621496918030 where Facebook has said "the stream table and me/graph have limitations. See the documentation for more info. We're trying to make this more clear in the future." Personally I don't think there is really any more info in the documentation though.

Get all posts on a friend's wall

I'm trying to find an API call (or set of calls) that will allow an app to get the posts that one would see if viewing a friend's wall. Either a REST call or a FQL call would do.
I tried /feed and /posts, compare the results with what I see on my friend's wall, and the results I get from it are incomplete.
I know this is possible because apps like Friendly are able to do it.
Any hints?
Well, there's two different API endpoints for querying the posts of a given user; home and feed. Home includes posts from other people and pages (basically what you see when you log in and go to your home page) and feed is the stuff the user is sharing. Assuming your application has authenticated the user and they've allowed the read_stream permission, you can then make queries to the Graph API using their access token:
https://graph.facebook.com/{SOME_USER_NAME}/home?access_token={SOME_ACCESS_TOKEN}
and
https://graph.facebook.com/{SOME_USER_NAME}/feed?access_token={SOME_ACCESS_TOKEN}
The only hint I could give you is that "incomplete" is pretty standard with the Facebook API. You can only do the best you can with what they give you. Counts will be wrong. Data will be wrong. It's a fluctuating, moving target, so code to that fact.
You can interact with posts by retrieving the read_stream and publish_stream for a given User's ID.
Once you have the ID of the User that you are interested in you can use FQL to retrieve posts from streams that you have the permissions for.
This stackoverflow answer goes into more detail and contains further links to the documentation on the Facebook Developers site.
We do it like this:
1) we use Facebook Platform PHP5 client
2) then what you do is:
$this->facebook = new facebook($key, $secret);
$out = $this->facebook->api_client->call_method("facebook.stream.get", array('viewer_id'=>0, 'source_ids'=>$uid, 'limit'=>$limit));
then just operate with out, which contains all posts on asked page.
but, afaik, it will work only with pages, not with normal users. but dig that way to get answer.
You should make a graph call to https://graph.facebook.com/< FBID >/statuses?access_token=xxxxx
Here access_token shall have read_stream permission and offline_access permission ..

How would I get a list of 'friends' who have added my Facebook application?

I'm really struggling with something that should be a simple matter: Showing a user of my Facebook app a list of their friends also using the app. Is there nothing built into the APIs to allow such a common request?
The only thing I can think of to do is to get the list of the user's friends, and then get all the users from my database who are in that list, and then fetch information for each of those facebook ids. But that seems an extremely roundabout way of doing things...
The only way I've found to do this is to use FQL and a previously documented, but now undocumented field:
SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=<user's uid>) AND is_app_user=1 ORDER BY name
The undocumented field is the user.is_app_user, which is listed in the old documentation wiki but not in the shiny new docs. No idea if this means it'll be removed in the future, but there doesn't seem to be any other way to get this data with the new Graph API.
Just in-case you're still using the old REST API, you can also call the friends.getAppUsers method.
You can actually use Facebook's old REST API to do this by sending a GET request to: https://api.facebook.com/method/friends.getAppUsers
If you need JSON data back, then add the parameter format=json
You need an access token to do this. See the documentation here:
http://developers.facebook.com/docs/reference/rest/friends.getAppUsers/