Returning the total number of contributors in a category

Hi @matthias - I have a question regarding getting the number of users who have contributed to a category.

It seems the number is inaccurate when we are looking to get the total number of participants (people who have posted and replied). Is there a way to get this from the Discourse API?

Thanks

Sorry for late response.

I looked around for half an hour but could not find a way to get the number of participants for a category via the Discourse API.

I did not find this information in the single category endpoint, list of categories endpoint or the site.json endpoint (which is otherwise quite useful; just discovered it). Also there’s no category_stats table, where this kind of information would be expected when following the Discourse nomenclature.

You can of course get this information via a SQL query that uses the Data Explorer plugin, and even access that via API – I’d have to slightly modify this query, which currently lists instead of counts category contributors. But the issue is here that Data Explorer queries are only accessible to logged-in users based on group membership, and cannot be made accessible to anonymous users. So this will probably not help, as I guess you’re looking for this to integrate it into a Vue.js based website.

So the only way to access this as part of the anonymous Discourse API would be a custom plugin that extends the Discourse API. Not sure if we have the budget for that right now – I’d say only if it’s really important, as it would compete for the remaining budget with necessary repairs and updates to Discourse.

1 Like

I think we can leave it for now @matthias if it requires additional work - just checking with you that I didn’t miss something available through the public API. Thanks anyway :slight_smile: