httr icon indicating copy to clipboard operation
httr copied to clipboard

GET not returning only the modified posts (If-Modified-Since) ?

Open VenkatArchitect opened this issue 10 years ago • 1 comments

My requirement/objective:

I'm retrieving Facebook posts for the past 3 months from a public page, and I would like to select only those posts which have been modified in the recent past (in the last 2 days).

I'm using httr R package, and using the GET function to accomplish the above.

I tried the following :

  1. url.data <- GET(url, config(token=token), config(add_headers("If-Modified-Since" = "2016-09-08 11:45")))

  2. url.data <- GET(url, config(token=token, add_headers("If-Modified-Since" = "2016-09-08 11:45"))

In the above 'url' has the 'since', 'until' fields specifying the time period (3 months) for which the posts need be retrieved. 'token' is the OAuth token for authentication.

In both of the above methods, all the posts are retrieved, rather than just the posts that are modified in the past 2 days. Am I doing something wrong, or is the functionality not performing as expected?

Please feel free to ask for more details, if required.

VenkatArchitect avatar Sep 12 '16 02:09 VenkatArchitect

I'd check that httr is doing what you expect with verbose(), otherwise you'll need to consult the details of the facebook API ("If-modified-since" does not usually behave in the way that you describe)

hadley avatar Sep 15 '16 14:09 hadley