1

I'm using the api @ api.foursquare.com/v2/users/USER_ID/checkins referenced here developer.foursquare.com/docs/users/checkins I am creating the request using vb.net but that's probably irrelevant. The issue I am having is that the response I receive seems to ignore the beforeTimeStamp value.

For example I have created a request url of this; (oauth_token masked – but is correct and works) https://api.foursquare.com/v2/users/self/checkins?oauth_token=####&v=20120214&limit=250&offset=0&afterTimestamp=1332720000&beforeTimestamp=1333238400 1332720000 is the Epoch date 26-03-2012 and 1333238400 is 01-04-2012 I would expect this to return all the checkins between those dates. However it always returns all checkins up to the most recent one, i.e. today 11/04/2012. I spent last night searching for answers to this and I am no further forward.

I could go ahead and write a paging method to move around the history log until I have just the ones I need. This would create multiple requests though. I even wrote a simple function to strip out checkins that were out of range once I had the objects back. However this seems wasteful, especially as the application I am writing has the potential to go back years in a users history. This would mean returning way more data than required, creating an unneccesary overhead. After all the searching I was just about resigned to doing one of the 2 workarounds above when I stumbled on the Foursquare API console at https://apigee.com/
If you have read this far, this is the main thrust of this question (unless anyone knows what I am doing wrong…) If I create a request using the apigee.com interface with the settings above, the response body only contains the checkins I need, i.e. the ones between the specified dates! If I use my app, it returns them all! My URL /v2/users/self/checkins?oauth_token=####&v=20120214&limit=250&offset=0&afterTimestamp=1332720000&beforeTimestamp=1333238400 Apigee’s URL (in the request box after execution) /v2/users/self/checkins?oauth_token=####&v=20120214&limit=250&offset=0&afterTimestamp=1332720000&beforeTimeStamp=1333238400

Spot the difference? Neither can I! Anyone have any ideas? Many thanks

Alistair
  • 13
  • 3

1 Answers1

0

I think you have a typo in your URL. beforeTimeStamp should be beforeTimestamp. That's why your second URL is not working. It further seems you mixed up Apigee's URL and your URL in your post.

Retrieving yesterday's checkins works for me as expected:

https://api.foursquare.com/v2/users/self/checkins?oauth_token=###&v=20120321&afterTimestamp=1334120400&beforeTimestamp=1334206799

Also no problem with the API version from 20120214. Also your URLs are working for me.

diewie
  • 754
  • 4
  • 8
  • Thank-you so much! Obviously I now feel stupid, but I honestly just didn't see that! I am just glad there was an answer... I probably just stared and stared at this way too long. I can confirm it is now working perfectly. Once again, many thanks for taking the time to point out my mistake, it's really appreciated. – Alistair Apr 12 '12 at 22:08