Is there a way to get full badge list for a user?

I’m evaluating integraton of the badge system into other part of a website. And I found in API document that it seems the only way to get a list of badge a user has it to use the /users/<username>.json API endpoint.

However after I tried this on myself on meta, I only saw three badges returned, the three that appears on my user card(are those called the featured badges?).

I searched in API document further more but didn’t see other API that returns badge information for a given user. Am I missing something or just that API don’t exist?

Try
https://meta.discourse.org/u/<username-here>/badges.json

Thanks but it returns the same payload as /users/<username>.json for me…

Hmm, I see what you mean. There was a recent change from “/users/” to “/u/” that may have something to do with it.

If you open your browsers dev tools and request a users badges page you should be able to see the URL that Discourse is using to get the page data. Is that different?

Thanks for the reminder. The API should be https://meta.discourse.org/user-badges/<username>.json.

Since the release of docs.discourse.org I was under the impression that all APIs are documented there. It seems this one is not yet.

3 Likes

Now it is documented for sure https://docs.discourse.org/#tag/Badges

4 Likes

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