How to query gamification score via the API?

Phenomenal plugin @Falco :green_heart:

Our community is integrated into a bespoke platform that rewards community engagement as one aspect of an overall membership score, is there any chance that the cheers score could be exposed as part of the adminGetUser API response? Is there any alternative way to query this data from the API in the meantime?

We are getting feedback from users that it is hard to discover the leaderboard. I have added a custom hamburger link but it would be great if people could access the leaderboard by clicking on the score listed on their profile (both the popup and profile screen). I understand that a community can have more than one leaderboard but if we could nominate a leaderboard that the link points to that would be a reasonable workaround.

Are these two items something that could be added to the roadmap?

5 Likes

You can make a theme component to add a onclick function onto the elements to change the URL of the page to the leaderboard.

2 Likes

It’s already exposed at the public user info endpoint

 curl https://meta.discourse.org/u/falco.json -s | jq . | grep score
    "gamification_score": 83015,

That’s a great suggestion, added to roadmap.

7 Likes

I see that I can get a users All Time gamification score via the /u/[username].json API - but what about for a specific period? Also - is there anyway to get the DETAILS of the score (how may likes vs reads vs Solutions etc.)

1 Like

That’s not possible at the moment. A possible workaround is creating a custom endpoint using data explorer that receives a user and a time period and returns the score of the user from that period.

See Run Data Explorer queries with the Discourse API

That’s not possible at the moment but something we plan on adding long term.

5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.