Get total list of topics and their view counts from Discourse API

AI-generated summary

The discussion revolves around retrieving a complete list of topics and their view counts from the Discourse API. paigen11 is looking for a simple way to get this data in JSON format, similar to the Discourse server’s landing page. j127 suggests using the Data Explorer plugin, which allows making SQL queries and getting results via the API. david recommends using the latest.json endpoint, which includes topic titles and view counts, and is documented here. However, pHneutre notes that this method requires looping through multiple pages, and asks if it’s possible to get all topics in a single request. paigen11 appreciates the suggestions and plans to explore them further.

Hello there,

I’m trying to see if there’s a way to reverse-engineer getting a complete list of topics and views for each of those topics via the Discourse API.

Ideally, something as simple as the landing page of a Discourse server with topic names and views in JSON format would be perfect, but from what I can tell from the API documentation there doesn’t seem to be an endpoint that can provide this high level overview.

Is there such a way to get this data in a nice format that I could pipe through to an analytics dashboard API?

Thanks in advance.

Would Data Explorer work? It’s possible to make SQL queries with Data Explorer and then get the results with the API.

Would https://meta.discourse.org/latest.json be good enough? That includes topic titles, and view count. Docs can be found here.

If you need more advanced filtering, then data explorer is also a good choice as @j127 mentioned :+1:

Thank you both for the suggestions - I’ll start checking out both of them this morning to see what might work. I appreciate it!

Hello, it seems like the best solution (if not using Data Explorer) is https://meta.discourse.org/latest.json. However one must loop through all the https://agora.les-cae.coop/latest.json?no_definitions=true&page={id} until no further data is found.

By any chance, is there a way to get all the topics in a single request?