Beeminder Forum

Does datapoint pagination work correctly, is this a bug, or am I doing this wrong?

Is the per parameter at /api/v1/users/u/goals/g/datapoints.json? broken? If I use it in conjunction with page, I get a 500!

For example, if I send this GET: /api/v1/users/aliddell/goals/drop-4-stone/datapoints.json?auth_token=D0th3M0n5t3Rm4sh!&page=2&per=24 I get my 500.

If I omit the page parameter: /api/v1/users/aliddell/goals/drop-4-stone/datapoints.json?auth_token=D0th3M0n5t3Rm4sh!&per=24, I get all 184 datapoints. This is expected behavior.

But if I keep page and just drop per, i.e., GET /api/v1/users/aliddell/goals/drop-4-stone/datapoints.json?auth_token=D0th3M0n5t3Rm4sh!&page=2, I get 25 datapoints back.

n.b.: unless it’s Halloween, you’re bound to be disappointed if you try to use D0th3M0n5t3Rm4sh! for my auth token. :^)

1 Like

The 500 is definitely an error in the API. I’ll file all of this on our bug tracker!

2 Likes