0
votes

Documentation that I found in developers.facebook.com is not helping much.

https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed

All I'm trying to do is get posts on a user's wall on given date.

This is the query I am trying:

https://graph.facebook.com/v2.3/<userid>/feed?since=1402684200&until=1402770600&access_token=<access_token>

For getting posts on June 14, 2014

Previous link in pagination takes me to page with recent posts (ie Apr 2015), and next link takes me to empty data.

I'm definitely missing something, please help me.

1

1 Answers

0
votes

It's always recommended to follow the pagination format returned by a given end-point. In your case, if you query the /user/feed end-point you would see the following paging object:

{
  "data": [
    // ...
  ], 
  "paging": {
    "previous": "https://graph.facebook.com/v2.3/USERID/feed?fields=id,created_time,updated_time&limit=25&since=1429182673&...", 
    "next": "https://graph.facebook.com/v2.3/USERID/feed?fields=id,created_time,updated_time&limit=25&until=1429182673&..."
  }
}

As you can see, to the next result set (in this case, back in time) you need to set the upper limit with the until as per the docs:

until : A Unix timestamp or strtotime data value that points to the end of the range of time-based data.

So to get the data for a certain date (say, 14/June/2014) you could either use until or since with the date configured to the end of day or start of the target day. Example:

GET /USERID/feed?limit=25&until=1402790340

This should return the data until that date - June 14th, 2014 23:59 (UTC)