Forum Discussion

samudhraa's avatar
samudhraa
Expert
11 years ago

Count of Popular topics at Category level

Hi All ,


How can I get a count of popular topics at category level or Is it possible to get the number of messages in kudoed message leaderboard. I am trying to a custom component for popular topics in forum (most kudoed) using ,

kudos/messages/leaderboard

 

However I need to paginate this , for which I am using Lithium's in built pagination component which requires a total count of all the messages in leaderboard.

 

Thanks,

Sam

 

 

  • Hi Sam,

     

    Are you trying to get a count of messages that have kudos in a category, or are you trying to get a sum of all the kudos given in a category?

     

    If the former, you could probably do a search for messages in the category that have kudos, using the "has_kudos" filter. For example:

    /restapi/vc/search/messages/count?location=category%3ADeveloper&has_kudos=true&collapse_discussion=false

     This would give you count of all of the messages in the "Developer" category that have kudos. To get the actual messages, you could just remove the "/count" path parameter.

     

    If you're wanting a sum of all the kudos instead, you could probably do so using the metrics call for a category:

    http://lithosphere.lithium.com/t5/rest-api/bd-p/developers-rest-api?leaf-id=Category.metrics#Category.metrics

    You would just need to determine the name of the metric (you can find this in the admin) and the desired time range.

  • AdamN's avatar
    AdamN
    Khoros Oracle

    Hi Sam,

     

    Are you trying to get a count of messages that have kudos in a category, or are you trying to get a sum of all the kudos given in a category?

     

    If the former, you could probably do a search for messages in the category that have kudos, using the "has_kudos" filter. For example:

    /restapi/vc/search/messages/count?location=category%3ADeveloper&has_kudos=true&collapse_discussion=false

     This would give you count of all of the messages in the "Developer" category that have kudos. To get the actual messages, you could just remove the "/count" path parameter.

     

    If you're wanting a sum of all the kudos instead, you could probably do so using the metrics call for a category:

    http://lithosphere.lithium.com/t5/rest-api/bd-p/developers-rest-api?leaf-id=Category.metrics#Category.metrics

    You would just need to determine the name of the metric (you can find this in the admin) and the desired time range.

    • samudhraa's avatar
      samudhraa
      Expert

      Hi AdamN ,

       

      Thanks for your response. It gave me some direction to solve my issue.

       I am trying to get the former - the count of messages that have kudos in a cateogory. I tried the REST call you mentioned , but I got 0 values of count , and no messages.

      I tried to modify the REST call , by querying within the category , simply for messages , without the has_kudos parameter (/categories/id/categoryId/search/messages) . I even tried a global search.

      But I am still getting empty response , when I know for a fact there are 4 messages with kudoes. 

      May be I am missing something ?

       

      Thanks,

      Sam

       

      • samudhraa's avatar
        samudhraa
        Expert

        Looks like I caught  myself. When I searched for a text ,using the q parameter , it returned an appropriate response. 

        ie., when I used something like this

        /categories/id/catId/search/messages?q=appit&has_kudos=true

         

        I got a list of messages.

        Now I would just have to figure out what to use as search parameter that would include all messages.

        Thanks again AdamN.

         

        Regards,

        Sam