# API user\_badges /users/username/activity/badges.json API vs. /user-badges/username.json

**URL:** https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958
**Category:** Development
**Created:** [16 במאי,‏ 2019,‏ 8:03pm UTC](https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958 "2019-05-16T20:03:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)
#### Post date: [16 במאי,‏ 2019,‏ 8:03pm UTC](https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958/1 "2019-05-16T20:03:39Z")

</div>

[In the API we see](https://github.com/discourse/discourse_api/blob/64476cc1782565108f9dd6213229663f0baa7eff/lib/discourse_api/api/badges.rb#L10-L13):

```
  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?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [16 במאי,‏ 2019,‏ 9:02pm UTC](https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958/2 "2019-05-16T21:02:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)
#### Post date: [16 במאי,‏ 2019,‏ 9:17pm UTC](https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958/3 "2019-05-16T21:17:42Z")

</div>

> [@justin](#):
>
> You can already hit this api endpoint at `https://<sitename>/user-badges/<username>.json` and it returns the full list of badges.

I’m speaking about discourse\_API code. Don’t see it [searching the code](https://github.com/discourse/discourse_api/search?q=user-badges&unscoped_q=user-badges).

---

<div class="post-metadata">

### Author: ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)
#### Post date: [20 במאי,‏ 2019,‏ 7:27pm UTC](https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958/4 "2019-05-20T19:27:56Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [20 במאי,‏ 2019,‏ 7:36pm UTC](https://meta.discourse.org/t/api-user-badges-users-username-activity-badges-json-api-vs-user-badges-username-json/117958/5 "2019-05-20T19:36:06Z")

</div>

If the only difference is that the latter one actually returns all the badges, I’m okay with replacing the existing method 🙂.
