Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 543
Mikey S. Avatar asked Sep 06 '11 08:09

Mikey S.


2 Answers

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/

like image 50
thefreeman Avatar answered Nov 16 '22 02:11

thefreeman


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.

like image 40
Fred Avatar answered Nov 16 '22 02:11

Fred