API - Get count of latest

Hi,

We need to display statistics about our Discourse instance on our main website.

We managed to display the total number of posts (call site.json, loop categories and addition all topic_count together).

However, we can’t seem to find a way to get the latest post amount.

Is there a way that we missed? Some helpful API call that would return only the latest (24h but we can settle for 48h) content?

Thanks,

Some of the data you are looking for is available at /about.json. It will give you the total number of posts and topics, and also data for the last 7 days and the last 30 days.

To get the post count for a specific time period, you can make an API call to any of the admin reports that are displayed on your site’s dashboard. For the posts report, you can make a query to /admin/reports/posts.json. The start_date and end_date can be set as query parameters.

4 Likes

I would have never imagined that the admin reports also had .json endpoints. That’s awesome.

Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.