Forum Discussion

dustin's avatar
dustin
Expert
10 years ago

Top Kudo Authors rest API in freemarker

After digging around the community, it seems it is possible to get a list of the top kudoed authors for the last week...

 

http://lithosphere.lithium.com/lithium/restapi/vc/kudos/authors/leaderboard?max_age=one_month

I would like to access this via freemarker, and need help getting it to work.  This is my best guess, but alas it does not work.  Any ideas what I'm doing wrong?

 

  <#assign authors = rest("/kudos/authors/leaderboard?max_age=one_week").authors />

  <#list authors as author>
        <div>${author.id}</div>
  </#list>
  • dustin - Here you go:

     

     <#assign authors = rest("/kudos/authors/leaderboard?max_age=one_week").users />
    
      <#list authors.user as author>
            <div>${author.id}</div>
      </#list>

    You need to hit the root node, there was no author node, but the user node for this. I hope this helps.

8 Replies

  • dustin - Here you go:

     

     <#assign authors = rest("/kudos/authors/leaderboard?max_age=one_week").users />
    
      <#list authors.user as author>
            <div>${author.id}</div>
      </#list>

    You need to hit the root node, there was no author node, but the user node for this. I hope this helps.

  • daphtan's avatar
    daphtan
    Director
    9 years ago
    Either of you possibly know if it Is possible to customize this so that it eliminates kudos from the idea exchange or other specific boards?
  • daphtan - Yes, but this would require you to change your community structure a bit. You can create a new category and move those areas in it which you want to include in the kudos leaderboard count. As this call can be made at the category or at a board level as well. I have added modified code over here:

     

    Say, you name your category as CATEGORY WITHOUT IDEAS, use this ID in the API below and you will get the kudo count from those areas only which are inside this category, you can keep Ideas and other areas out of this category.

     

     <#assign authors = rest("/categories/id/[CATEGORY_WITHOUT_IDEAS_ID]/kudos/authors/leaderboard?max_age=one_week").users />
    
      <#list authors.user as author>
            <div>${author.id}</div>
      </#list>

     

    I hope this helps.

  • gstelang's avatar
    gstelang
    Mentor
    9 years ago

    Hi Varun, 

     

    Is this documented somewhere such as what does the API return?

     

  • gstelang's avatar
    gstelang
    Mentor
    9 years ago

    Hi ChiaraS

     

    Sorry for yet another question on the topic.

     

    How is this different from API v2 which is SELECT * FROM users ORDER BY kudos_received.sum(weight) DESC ? 

     

    because I get 2 different set of results.