Forum Discussion

peterlu's avatar
peterlu
Champion
12 years ago

kudos received query based on time range

Hi, below is the query to get a total kudo received count for a user.

/restapi/vc/users/id/3080/kudos/received/count

 

This query works for search

/restapi/vc/search/messages/count?author_id=7&q=date%3A%5B1360635847%20TO%201363228065%5D 

 

Is there a way to do this to get kudos received for the past 7 days/last month/etc?

 

another similar question is, for the below api,

/restapi/vc/users/id/7/solutions/received/count

How do we put a time range on this call as well?

1 Reply

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    Hi peterlu,

     

    I'd suggest checking out the metrics method in the User class. This will give you back a Metrics object from which you can obtain additional information about the user's metrics:

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

     

    You'll need to know the names of the metrics you're interested in. These names should correspond to the names in the Community Admin. Once you have the name, you can chain to the previous method:

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

     

    There are a few different Kudos metrics. You'd probably be interested in net_kudos_weight_received which tells you how many Kudos they've received, and accounts for any Kudo weight that you may have given to certain users. Similarly, for Solutions I think you'd want net_accepted_solutions.

     

    So your calls might look like:

    /users/id/122/metrics/name/net_kudos_weight_received

    /users/id/122/metrics/name/net_accepted_solutions

     

    You can use the date_start and date_end parameters to fine-tune your results as needed. For example:

    /users/id/122/metrics/name/net_kudos_weight_received?date_start=2013-08-09T08:00:00Z

     

    I hope this helps!