Search code examples
facebookfacebook-graph-apifeed

Get home feed of a particular user of a specific time stamp using graph API


I am trying to build a Facebook application by using Facebook Graph API. I am trying to get the home feed of the application user for a particular time span. e.g. From 11-02-2014 to 15-07-2014. I have used since and until in Facebook Graph Explorer but it returned news feed of two consecutive days.


Solution

  • 2011-01-01 is the wrong synthax to represent a time on Facebook. You should use Unix timestamps: 1418971177.

    A time-paginated edge supports the following parameters:

    • until : A Unix timestamp or strtotime data value that points to the end of the range of time-based data.
    • since : A Unix timestamp or strtotime data value that points to the start of the range of time-based data.
    • limit : This is the number of individual objects that are returned in each page. A limit of 0 will return no results. Some edges have an upper maximum on the limit value, for performance
      reasons. We will return the correct pagination links if that happens.

    Source: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#


    So, instead of:

    /me/home?since=2011-01-01&until=2011-05-05

    You must use:

    /me/home?limit=25&until=1418971177 with until.

    Or:

    /me/home?limit=25&since=1418971128 with since.

    Note that you can't use since and until together. You have to use the limit field to restrict the amount of results you get.