Forum Discussion
hoffmanilya - Users aren't stored in the category, So, there is no clean way to achieve this. However, as a workaround, you can achieve this by doing following.
1. Loop through all the threads of a category.
SELECT * from messages WHERE category.id = '<id>' and depth = 0
2. Get all the participants of thread and store in a variable.
http://community.lithium.com/community-name/restapi/vc/threads/id/[id] /participants/count
- hoffmanilyaContributor
TariqHussain - Thanks for your reply. I'm not exactly sure I understand the workaround you're proposing. Could you please share a link to the API endpoint doc? I can't seem to find that either. It looks like the call in step 2 would simply return the count of participants in the thread - is that not accurate?
I'm looking for something like this:
Category: Cat1
User 1, 2 kudos given, 1 kudos received, 10 replies posted, etc.
User 2, etc.
Upon further reading it seems like the only way to get these aggregated stats is to use the Bulk Data API and load all the events in another data store and then do the aggregations myself. Would that work and/or is there an easier approach?
- ClaudiusHKhoros Alumni (Retired)
I recommend you drop the LiQL query
SELECT * FROM messages WHERE category.id = '<id>' AND author.login= '<community_username>'
in the "API Browser" within Lithium Studio on your stage environment. This will show you which information is already returned for each user that way. Going over a return item I could spot the number of replies, if the message was a solution and the number of views for each message. For obtaining the number of kudos you would need to use the linked kudos API call for each message (!) within that thread.
Maybe you want to share a bit more details of whether you are trying to build a leaderboard for your members across each category or individual stats for the current member when viewing a category. This could help providing alternative solutions.
Related Content
- 4 years ago