News Feed via graph API very different from what I see at facebook.com - facebook

I'm experimenting with the Graph API, specifically the News Feed query (me/home). And right off the bat, I can see that the JSON returned does not match what I see on my own facebook page. The API returns some objects that are not on the page, and vice versa. I can't figure out what's going on here. I don't think it's about people I've unsubscribed from or anything like that.
Is this expected behavior, or am I doing something wrong? Is there documentation somewhere that explains what the difference is?
edit 22-Nov-11: this is never going to be answered, is it.

NewsFeed via api ordered by time but on facebook.com ordered by top stories
Open your recent news feed > https://www.facebook.com/?sk=h_chr
you will find that it's the same as api (y)

Related

Difference in Engaged Users (Facebook page) and Engaged Users (Insights API)

We have a tool connecting with the Facebook Insights API to grab various metrics (Likes, Comments, etc).
One such metric is the Lifetime Engaged Users.
However, we've looked at many FB pages (not going through the API) and the insights numbers seem to be different.
I have used the Graph Explorer to check if there is an error in our request, and this is not the case. For example, in one case, the call returns "13480".
Here is the screenshot from the Insights page:
FB Insights Page
I may not be checking at the correct numbers, but can someone help me out?
I would like to figure out how I can find this particular metric, other than using our tool or using the Graph Explorer.
Thank you!
Try this: go recheck your call to API, remove that S from "metricS=metricName".
I met this problem today, and find that there are two ways to get object insight data:
object-id/insights/metricNameA,metricNameB
object-id/insights/?metric=metricNameA,metricNameB
I happened to use the 2nd way, and wrongly typed metricS instead of metric, which led to return an array of data for all metrics, and my code data[0].values[0].value therefore got the first metric in that array which is "post_story_adds_unique", if you have same mistake as mine, that 13480 could be this 1st metric return by default from FB.

How to get all user's likes using facebook's graph API

How can I query facebook's graph API to retrieve all user's likes (not only pages but also photos and others)?
For instance, how could I get all the pictures a user has liked? Using facebook's search bar you can find them easily by clicking on "photos has liked".
I wrote a script that scrapes the page content and does that but it's not very efficient.
I have recently come accross a similar problem, maybe this helps you solve it.
https://graph.facebook.com/v2.5/{page_id}/feed?fields=likes.limit(1).summary(true)&since={start_date}&until={end_date}&access_token={access_token}
This will give you a list of all posts that received likes during the specified time period. If you manage to write a code summing up the following JSON path you got your sum for "all user's likes":
data[0].likes.summary.total_count
Not entirely sure is this is exactly what you were searching for, hope it helps you though - and if not you, someone else.
As for likes you can also use the same way to extract Shares and Comments:
Shares
https://graph.facebook.com/v2.5/{page_id}/feed?fields=shares&since={start_date}&until={end_date}&access_token=
Comments
https://graph.facebook.com/v2.5/{page_id}/feed?fields=comments.limit(1).summary(true)&since={start_date}&until={end_date}&access_token=
Best regards
There isn't to my knowledge any way to get this from the API without grabbing every type of response from the API and then sorting through for likes. Facebook search bar uses an internal API different from the Graph API.

"Top Posts" depending on facebook likes

I have an idea to create a "top posts" feature to my website, which creates the "top" list depending on how many likes and shares that a post have on facebook.
Users may see how many likes an post has received so far since they only have to ask for a single, defined url. However, the website itself has to be able to query all the links that are tied to itself (which have a predefined url template like website.com/[post-id]) to create the "top" list. Is it possible to do something similar (or achieve the same result in a different way)?
Any ideas on a real workflow about something like this will be appreciated!
this seems like a little but interesting project. I don't know if there is a feature that could get that directly in the way you want, but i did something similar.
First you have the Graph API, with that you can get the Posts of a user using feed, with that every post is telling you how many likes does it have which you can get with POST_ID/likes.
Then you'll have to check for changes in the post periodically comparing its created_time and updated_time.
This could seem very hard, because you have a lot of posts and you have to check them all for updates, but you can use batch_requests so you can check them all at once.
I have made a bookmarklet which shows top posts in the Facebook News Feed as well as Google+, Twitter and Instagram Profiles.
Just add a new bookmark in your bookmarks bar and replace its URL with the following code and save it, then go to the social network website and run it:
javascript:(function(){var s=document.createElement('script');s.src='https://niutech.github.io/topnewsfeed/topnewsfeed.min.js';document.body.appendChild(s);})()
The source code is available on GitHub.

Facebook and suggestions

I'm trying to write a simple application that finds out who liked your page. I used FQL and a query very similar to:
$query = 'SELECT user_id FROM like WHERE object_id="149187568469862"';
The first issue is that FB returns an empty array. Maybe the data will be available in the near future.
I will describe the most important issue. If the user X liked my page, I would like to know who suggested X to like my page. Maybe nobody, but there are chances that X pressed "Like" after a suggestion coming from a friend. I browsed the documentation, but I didn't find relevant information about how can I see who liked my page as a result of a suggestion. Do you have any ideas?
Thanks,
As far as I know you can not retrieve any historical information on who referred a "like". Furthermore, as of right now facebook does not seem to allow querying for all your pages "fans" (which is basically everyone who likes your page). They do, however allow looking up all pages that a user "likes" using fql. Much of their documentation is very "skinny" on examples. I actually learned the most by downloading the facebook connect javascript toolkit which came with some client side examples of the most used functionality. https://github.com/facebook/connect-js - this may be a good place to start

Retrieve group events with Facebook Graph API

I'm a little confused trying to adapt to the new facebook Graph API.
Whereas before I would have used events.get, I'm not entirely sure what to use now!
I can't seem to get a list of a group's events through fql, nor through the Graph API itself.
Any pointers? Should I keep using REST?
In the documentation under "Connections" it doesn't appear that you can get /events. Or for that matter /albums or anything useful...
http://developers.facebook.com/docs/reference/api/group
However, if you know that something is an event (which you could probably do because the link in the data has "eid" in it - I can't see a way beyond that) then you can call the event URL (http://developers.facebook.com/docs/reference/api/event) and get the details that way.