Can I get only the new Facebook comments since the last time I checked instead of all comments every time?

Right now I have an app that allows a user to schedule/post a Facebook post and then monitor the likes/comments. One of the problems I foresee is that currently I am pulling every single comment/like whether it's been processed or not. What I would like to do instead is be able to say 'Give me all the NEW comments since XYZdate/XYZcomment.' Is this currently possible?

            var accessToken = existingUserNode.Attributes["accessToken"].Value;
            var facebookAPIMgr = new FacebookWrapper.FacebookAPIManager();
            var msg = new FacebookWrapper.FacebookMessage()
            {
                AccessToken = accessToken,
                FacebookMessageId = facebookPost.FacebookMessageId
            };

            //Get Facebook Message Comments
            // Need to find a way to limit this to only new comments/likes
            var comments = facebookAPIMgr.RetrieveComments(msg);

Answers


You can do time-based pagination as part of your graph API query. If you keep a unix timestamp of when you polled things last, you can simply do https://graph.facebook.com/{whatever}?since={last run}.

This worked when I was working heavily with the Graph API earlier this year, and is still around on the documentation, but considering how much Facebook loves to change stuff without telling anyone you may still encounter problems. So just a warning, YMMV.


Need Your Help

pass setProperty to inner object's setProperty

java properties javabeans

I have a UserPass class which has 2 properties: User user; String password

'for' loop initial declaration used outside C99 mode

c dev-c++

Any ideas why I am getting that error? I thought I'd done everything fine, it wasn't showing any errors before I coded past it?