5

I made a Facebook Application that people use to share links from my webpage to their walls, and now I need to get back a list of the posts made through it during a pediod of time (e.g. from Sep. 4th to Sep. 10th), incluiding their Post IDs.

I am aware that I could save that information at the moment of its publication, but I need some old data that I didn't save that way.

I have tried using FQL, but that requieres to indicate the source_id (Facebook ID of the user's wall where the post is on), which I am not able to know.

The Graph API object for my application doesn't seem to help either, since it doesn't have a connection for the posts made through it.

Any help would be really apreciated, even just a sign in the right direction.

rodrigo.garcia
  • 557
  • 7
  • 11

2 Answers2

2

As suggested, prompt the user for read_stream permissions, and then I'd suggest to take the fql route:

 SELECT post_id, actor_id, target_id, message 
 FROM stream 
 WHERE attribution=[your app name] 
       AND created_time > [since]
       AND created_time < [until] 
       AND filter_key in (SELECT filter_key 
                          FROM stream_filter 
                          WHERE uid=me() AND type='newsfeed')

It's not likely to be an issue, but be aware that there's a limit in the number of items returned, so if your time span is wide and your users posted a lot, you may have to play with the [until] and [since] a bit more and make several calls to retrieve everything.

Also take a look at the documentation for more information about fields you can query: http://developers.facebook.com/docs/reference/fql/stream/

Bruce P
  • 19,995
  • 8
  • 63
  • 73
  • Actually I do have read_stream and offline_access permissions, but I didn't store the user ID's of the people that used my app, so the problem is that I would have to wait for every user to come back and use my app again, and then I could execute that query. What I would like to be able to do is to get all posts made through my application, without having to know the user ID's of the people who made them (which your query would solve by using the `me()` function, if I were to wait for every user to come back to my app) – rodrigo.garcia Sep 17 '11 at 20:18
0

Prompt the user for read_stream permissions and then query /me/statuses and look for updates from your application.

bkaid
  • 51,465
  • 22
  • 112
  • 128