javafacebook-graph-apispring-social-facebook

Fetch new posts from facebook using Graph API


I am using Graph API to authorize a user with my app to fetch posts from their timeline and from their liked pages.

I'm able to fetch all posts and save them. But, when I fetch again after a period of time it includes both the new posts and old ones which creates duplicate entries. I only want the new posts which are not fetched yet. I know about the webhooks in facebook. But, I want to know any other way to do this just like twitter (using since_id).

NB: I'm using spring-social-facebook for these operations.

Looking for some ideas.


Solution

  • I think that you can use since and until parameters to filter the results. Try this call: https://developers.facebook.com/tools/explorer/135669679827333/?method=GET&path=me%2Ffeed%3Fsince%3D1%20january%202017%26until%3Dnow&version=v2.5

    You can store your lastUpdateDate and then use since lastUpdateDate until now.