最新トピック API のページネーション

みなさん、こんにちは!

このトピック と同様に、/latest.jsonトピック)エンドポイントでの適切なページネーション方法を探しています。特に、最後のページをどうやって知るかが知りたいです。

取得すべき結果がまだ残っている場合、レスポンスには次のページを示す "more_topics_url": "/latest?page=X" が含まれていることは分かりました。しかし、私のテストでは、結果がもうない場合でも、このフィールドに別のページが返ってくるようです。

最後のページに到達したことを判断する適切な方法はありますか?

よろしくお願いいたします!

I can’t reproduce this.

For example, you can request

https://meta.discourse.org/c/site-feedback/blog/l/latest.json?page=1

that contains 30 topics and a more_topics_url with "/c/site-feedback/blog/l/latest?page=2".

Then you request that and get 25 more topics and a missing more_topics_url because it’s the end.

「いいね!」 2

Thanks for such quick response and for checking it out!

You’re right. I was messing on my development environment on the per_page settings trying to avoid creating 30+ topics to test this, and came across this method, but changing it there seems to have the side-effect I mentioned, though returning the amount of results I set there.

Seems like passing ?per_page=X doesn’t have any effect on this endpoint (following your example: https://meta.discourse.org/c/site-feedback/blog/l/latest.json?page=1&per_page=5, still returns 30 rows). Is there a proper way to adjust this setting?

Thanks again in advance!

「いいね!」 2

この問題を解決した人はいますか?

この per_page の機能にも興味があります。

「いいね!」 1