Latest topics JSON - How to load paginated data?


#1

When scrolling down the ‘latest’ view in Discourse, the page lazy loads more topics as one scrolls down. Is there any way to load more topics via the latest.json endpoint? Is there a pagination parameter that can be passed to the JSON endpoint?


(Dean Taylor) #2

Pretty sure this has been covered many times before…

But the simple answer is, this is what is called by the page as you scroll:
https://meta.discourse.org/latest.json
https://meta.discourse.org/latest.json?no_definitions=true&page=1
https://meta.discourse.org/latest.json?no_definitions=true&page=2

Use Chrome Dev tools and look in the Network tab for XHR requests to find out what Discourse calls when you perform actions.


#3

Sorry, I wasn’t able to find anything through a number of searches, but thank you for your help, this is perfect and you are right, looking in the Network tab is very useful.

To point out a further oversight on my behalf, the JSON file itself contains, in the topic_list array: more_topics_url :blush:


(Kane York) #4

And that will be missing (or null?) when you run out :wink:


(system) #5