producthunt / producthunt-api

Product Hunt API
316 stars 29 forks source link

Votes Pagination #114

Closed brentchow closed 7 years ago

brentchow commented 7 years ago

Having an issue retrieving older votes:

https://api.producthunt.com/v1/posts/1/votes returns the following (shortened for brevity):

{
  "votes": [
    {
      "id": 4101826,
      "created_at": "2016-05-07T21:01:43.475-07:00",
      "post_id": 1,
      "user_id": 85429,
      "user": {...}
    },
    {
      "id": 22531,
      "created_at": "2014-03-07T08:04:31.730-08:00",
      "post_id": 1,
      "user_id": 5513,
      "user": {...}
    }
  ]
}

I tried to retrieve votes older than the first/newest vote (should return the second vote) using https://api.producthunt.com/v1/posts/1/votes?older=4101826 but returns with an empty array:

{
  "votes": []
}

I noticed that the front-end web app uses an offset param, but that didn't work for the API.

Thanks in advance.

andreasklinger commented 7 years ago

thx mentioned here as well https://github.com/producthunt/producthunt-api/issues/113 will look into this today

andreasklinger commented 7 years ago

This should work now again - please verify and reopen in case it is not working as you expect it to

brentchow commented 7 years ago

Working! Thanks!