Facebook API: Get the liked links - facebook

I am trying to get information on all links that a user has liked. in the past month.
I have obtained the user_likes permission from the user and am trying to use the FB Graph API.
I have tried:
/{user-id}/feed but it is only working for me not the users.
/{user-id}/likes but it only gives the pages, movies, apps, etc liked not the links likes.
/{user-id}/link doesn't give anything even when I see users have liked/shared a link.
Any suggestion will be much appreciated.
Thanks.

As far as I know there's no way to do this in the Graph API. But you can use the FQL table url_like (https://developers.facebook.com/docs/reference/fql/url_like/) to get your info:
select user_id, url from url_like where user_id=me()
Shares have nothing to do with URL likes imho...

Related

How can I get the details of all fans of a Facebook page?

Suppose that I am the administrator of a Facebook page, I want to get all of the profile details of a the people who "liked" my page. Is this possible? How?
So far, I have only been able to get aggregated data through the Graph API. For example, "number of like in the past week".
There are posts that claim that I can do this with the FQL API, but the documentation for the FQL seems to have been hidden on FB developer site.
FQL reference is not "hidden", it's here: https://developers.facebook.com/docs/reference/fql But there's no current official way to get the profile details of your Page's liker, because you'd need the permission to query the user data from the users.
There are some "hacks" as denoted at Facebook API: Get fans of / people who like a page for example, but it's strongly advised that you don't use these. Facebook forbids scraping for example, and once Facebook changes its website, those methods are likely to stop working.

How can I find the application that posted a Facebook photo via Graph API?

I have an application that pulls in content from both Facebook and Instagram, but users frequently cross-post the same photo. Using the Facebook Graph API, I'm trying to find a way to determine if any given photo was posted via Instagram.
I'm confident that this data exists, but I don't know how to access it via the API. Looking at one of my own cross-posted photos, I know Facebook at least has the data:
Have a look at the similar questions
How to get Likes of Instagram photo posts in Facebook Graph API?
Posts from Instagram not showing up on Facebook Open Graph API
And the bug report at FB: https://developers.facebook.com/bugs/110563582419837/
You could query the "Instagram Photos" album with FQL:
select pid, images from photo where album_object_id in (select object_id from album where owner = me() and name='Instagram Photos')
There were two solutions.
We only were asking for user_photo and user_status permissions. If we had asked for read_stream, we could have looked at the /me/posts endpoint, which offers the application field. We might do this, but the permissions could be confusing for users since it also allows us to read their newsfeed. Ideally, there'd be a user_posts permission that just gave us access to everything the user posts, but nothing posted by their friends.
Every Instagram photo shared is put into the same Facebook album. So, we just check to see if a photo is put in that album and disregard it if they've also authenticated with Instagram in our application. It feels less reliable, but it works.

Is there a way to get posts from our facebook fanpage users via FB API?

Is there a way to get posts from our fanpage users (the things that our fans post on our fanpage wall) via FB API (app)?
I have been looking for a while but could not find any helpful resource regarding to that.
Thanks.
To get the posts by others on your Page's wall you can use Stream FQL like,
select message,actor_id from stream
where source_id=Your+Page_ID and actor_id != source_id
Which would retrieve the Posts on your Page wall authored by people other than you.
Check the PAGE_ID/feed/ connection. Posts and comments should be in there you just have to filter it.
https://developers.facebook.com/docs/reference/api/page/
Example try the Python page - https://developers.facebook.com/tools/explorer?method=GET&path=pythonlang%2Ffeed

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