Is there any way to access the site statistics via the API? We’re trying to put some of these metrics inside a larger graph, and it would be great to be able to do that via the proper API instead of screen-scraping the dashboard or something else similarly hackish.
I think that with the data manager plugin you can download statistics via the api.
Edit: it’s data explorer plugin.
Thanks for the hint, I’ll have a look at it.
We also just found out that /admin/dashboard.json should offer what we need for that purpose.
Yes, and there are endpoints like https://meta.discourse.org/admin/reports/page_view_total_reqs
for individual stats.
This endpoint is good, but not seeing any others being exposed, or at least Docs doesn’t reveal them.
Does anyone know if any others are exposed? I am thinking a lot of us, or at least some of us, have organizations which keep a data warehouse with stats and being able to access reports via the API would be helpful for them.
Edit: any of the reports from the Dashboard can be viewed in json format by just appending .json
to the URL, i.e. /admin/reports/visits.json
- and that’s helpful. However there isn’t a way that I have found to allow you to set the timeframe for the data.
Edit2: and it looks like you can get some customised timeframes ala /admin/reports/visits.json?category_id=all&end_date=2018-02-08&start_date=2018-01-01
but you do have to adjust the timeframe in the report first to then get the fields you can update