Forum Discussion

PerBonomi's avatar
9 years ago

Count users with rank

I'm looking to loop through the ranks and count the number of users for each.

The API seems not to want to let me retrieve much data when it comes to ranks.

 

Has anyone done this already?

  • PerBonomi - Depending on the size of your community, and the purpose - I assume you need this for reporting purpose, right?

     

    The closest thing I found here is: 

     

    SELECT id FROM users WHERE rank.name = 'Community Manager' LIMIT 1000

     You can just get the size from this call, the Limit 1000 is set so that if the size is more than 1000, you can paginate to second page. You'd need to pass the ranks manually. Once you get all the data, you can combine into one.

     

    I hope this helps.

    • ChiaraS's avatar
      ChiaraS
      Lithium Alumni (Retired)

      Do you need that information in a custom component? Or what's the use case / scenario?

      • PerBonomi's avatar
        PerBonomi
        Boss

        I was thinking I might publish a simple overview of the ranks, so users can see their progress in a more visual manner.

         

         

        However, there seems to be no way to use the API to find out how many users have a certain rank.