Forum Discussion

karthikeyan's avatar
7 years ago

Fetch Kudos given by user in API 2.0

 

SELECT COUNT(*) FROM kudos WHERE user.id = '4423'

Hi All, 

I would appreciate if someone answers my questions, I'm trying to get the count of the query, I wanted to fetch the list of kudos given by the user related to the board.id = 'AnaplanIdeas'.

When I tried to use the count of a method, It doesn't return the results, I see the errors.

 

Thanks!

 

  • karthikeyan

    You can use total kudos count of users in board using below API

     

    http://community.lithium.com/community-name/restapi/vc/boards/id/video_cards/kudos/givers/leaderboard

     

    • karthikeyan's avatar
      karthikeyan
      Guide

      ParshantSuzieH

      As far as I understand, The leaderboard gives a list of users, right? I want to use it for the current logged in user. If your recommendation is the right approach then How do I use it in the code, Do you have any example, please?

      board id is "AnaplanIdeas"

      The community name is "community.anaplan.com"

      Thanks!

  • Or you can try to go over the metric collection with API v2

    SELECT * FROM metrics WHERE id IN('kudos_events_received') AND user.id = '<userid>'

    but this will only give you the total count of kudos for a user overall (I think), according to the docs this (at least technically) should work, but it doesn't:

    SELECT * FROM metrics WHERE id IN('kudos_events_received') AND user.id = '<userid>' AND board.id = '<boardid>'

    will give this very informative error =):

    {
      "status" : "error",
      "message" : "invalid query syntax for SELECT * FROM metrics WHERE id IN ('kudos_events_received') AND user.id = '<userid>' AND board.id = '<boardid>'",
      "data" : {
        "type" : "error_data",
        "code" : 603,
        "developer_message" : "",
        "more_info" : ""
      },
      "metadata" : { }
    }

    maybe SuzieH can gather some info here why this constraint combination doesn't work, while others (such as role.id and board.id together) do?

    To summarize: For now it seems that Parshant's API v1 call is what you want to use for your use case...unfortunate, yep.

    • SuzieH's avatar
      SuzieH
      Khoros Alumni (Retired)

      Thanks for pulling me in luk. The inability to constrain by the user ID/board ID combo seems to be a bug. I'm passing on the question to Engineering for verification. karthikeyan, Parshant's reply to use V1 to find the count is the right path at this point. Unfortunately, we have not built out support for constraining the Users collection by board ID. That would be the most efficient solution.