Get all latest entries in users news feed - facebook

Does anyone know of a way to retrieve the users entire news feed? Querying /me/home does filter some stories from. Also, it seems to retrieve the top stories. Is there any way to retrieve the latest stories?
It doesn't matter whether it's through the Graph API or FQL.

me/home is pulling posts in order of created date on my end
https://developers.facebook.com/tools/explorer/135669679827333/?method=GET&path=me%3Ffields%3Dhome.limit(20).fields(created_time%2Cupdated_time%2Cid)
try this as your query, you can mod fields to include any you need.
me?fields=home.limit(20).fields(created_time,updated_time,id)
if it is still out of order because of your cookie settings from the actual home feed, you can force it to reorder by passing the array in sort(); "php".
for sort() refer to: http://php.net/manual/en/function.sort.php

Related

Facebook graphapi page/feed returning items sorted by relevance instead of recent activity

Hi I am using the Facebook graph api tool and attempting to get the feed of a public page. I want to get most recent comments first. However the feed returns comments and replies sorted by "relevance", is there a "sort" I can apply or how do I change this to get recent comments and replies within my posts?
I do not own the page I am getting the feed from.
There's the order parameter for comments, which can have the following values:
chronological
reverse_chronological
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5#ordering
As far as I know, the feed's posts will always be sorted by created_time, and there's no way to influence this via the Graph API requests.

Is there any way to pull the latest comments and likes from Facebook?

I am saving a particular media's likes and comments in the database. I am fetching the likes and comments of the media using Graph API every 1 hour to have the latest data. But Every time I fetch the data using Graph API, I notice that there is no particular order in which the data is returned. The latest comments and likes(new ones) may be returned in the second or the third pagination which is in no particular order.
Is there any way(any particular filter which we can apply) to access the latest likes and comments(new ones) made on a particular media.
Please Advise!
You can use the since parameter to check for new feeds. Simply store the updated_time field for the most recent comment you received, and then you can use that time as the since parameter to request the next set of comments.
https://graph.facebook.com/v2.3/<page-id>/feed?fields=updated_time&since=<last comment received>

Get the comment of a specific User- Facebook API

I want to get the list of comments made by given user through Facebook Graph API.
I haven't found any direct way to get lists of comments. So, I tried to find them through my feed, but it's returning all feed posts. Can we filter other posts where I have not commented?
I tried various queries as below, but could not get exactly what I need.
/me/feed?fields=comments?fields=from?name="my_name",message
/me/feed?fields=comments.fields(from.name("my_name"),message)
I need either (1) list of all comments by me or else (2) lists of posts which I have commented on, filtering out all other posts.
How can we do this?
There's no way to filter via the Graph API. Basically what you want to achieve is IMHO not really possible.
What you could theoretically do is use the comment FQL table, but the field you'd need (fromid) is not indexable: https://developers.facebook.com/docs/reference/fql/comment/ So this could be tough.

Get facebook user checkins

I need to get a list of a facebook user checkins both in photos and in status.
I tried to use graph api to query /me/locations' like:
$this->api->api('/me/locations?limit=1000');
It returns me a list of user checkins with three different types: photo, checkin or status.
My problem is that I need to get the photos that have user checkins but I can't seem to find it.
Can anyone help?
Thanks
If you look at the User documentation, under the title feeds, it lists a method of fetching only the posts which have a location (Checkin) in it.
https://graph.facebook.com/me/feed?with=location
As for getting Photos with a location (Checkin), there doesn't seem to be any documentation that suggests that the Photos can be filtered similar to the way Posts can be filtered. At best, I guess you will have to fetch all photos and then filter out the ones that do not have the place tag. Posts use the location tag while Photos use the place tag.

Graph API - Get latest news feed entries instead of "top news"

I'm working on a module to my web application which is supposed to display latest news feed entries for a specific user.
I was wondering if it's possible to add a certain "orderby" parameter to the graph api url in order to fetch the "latest news" instead of facebook's default "top news" which arranges the order using popularity and other elements.
I'm currently using the following url:
https://graph.facebook.com/me/home?access_token=...&limit=10
but again, this does not return the latest entries.
Does anyone know how to solve this?
You can use FQL rather then Graph to query the "stream" table. FQL supports order by statements similar to SQL. http://developers.facebook.com/docs/reference/fql/
For your specific example it would be
SELECT post_id FROM stream WHERE source_id=me() ORDER BY updated_time DESC
Obviously you will want to query more then just the post_id, you can find the full list of fields here http://developers.facebook.com/docs/reference/fql/stream/
Mikey, I've been trying to do the same thing. During my tests I found that the Facebook API didn't return all the entries it was supposed to.
Meaby in some way it's prevent you from seeing all updates correctly.
Try this :
In your browser open : https://graph.facebook.com/me/home?access_token=
then
Go to the Facebook Graph API Doc : https://developers.facebook.com/docs/reference/api/
and click the News feed: https://graph.facebook.com/me/home?access_token=... link in the page.
Check if the two page show the same output.