In the API we see :
def user_badges(username)
response = get("/users/#{username}/activity/badges.json")
response.body['badges']
end
But that does not get all the user’s badges. From Discourse>user>badges this call is made:
user-badges/username.json
which does give all the badges.
I need the second one. Add it to the API and do a PR? What should I call it?
1 Like
justin
(Justin DiRose)
May 16, 2019, 9:02pm
2
You can already hit this api endpoint at https://<sitename>/user-badges/<username>.json
and it returns the full list of badges. Are you looking for something else?
1 Like
I’m speaking about discourse_API code. Don’t see it searching the code .
Unless I get other feedback, my sense is to replace the existing API method
def user_badges(username)
response = get("/users/#{username}/activity/badges.json")
response.body['badges']
end
with
def user_badges(username)
response = get("/user-badges/#{username}.json")
response.body['badges']
end
Comments?
blake
(Blake Erickson)
May 20, 2019, 7:36pm
5
If the only difference is that the latter one actually returns all the badges, I’m okay with replacing the existing method .
3 Likes