# 如何从 API 获取"badge-notification"？

**URL:** https://meta.discourse.org/t/get-badge-notification-from-api/106614
**Category:** Development
**Created:** [2019年一月15日 18:29 UTC](https://meta.discourse.org/t/get-badge-notification-from-api/106614 "2019-01-15T18:29:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rbrlortie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rbrlortie/32/166740_2.png) [@rbrlortie](https://meta.discourse.org/u/rbrlortie)
#### Post date: [2019年一月15日 18:29 UTC](https://meta.discourse.org/t/get-badge-notification-from-api/106614/1 "2019-01-15T18:29:01Z")

</div>

Hi,

Is it possible to get the number of notications from the API?

The one next to the user’s avatar: ![image](https://global.discourse-cdn.com/meta/original/3X/6/0/6011f05fa5434f8890e06a12c31200419ab3224f.png)

We did find this call `/notifications.json?recent=true&limit=5` however this returns more than only the badge and would require us to parse the json and count everything over again. (Only this seems to come up from the search.)

Thanks,  
R

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年一月15日 23:47 UTC](https://meta.discourse.org/t/get-badge-notification-from-api/106614/2 "2019-01-15T23:47:38Z")

</div>

I suggest referring to [Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)

---

<div class="post-metadata">

### Author: ![rbrlortie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rbrlortie/32/166740_2.png) [@rbrlortie](https://meta.discourse.org/u/rbrlortie)
#### Post date: [2019年一月16日 14:30 UTC](https://meta.discourse.org/t/get-badge-notification-from-api/106614/3 "2019-01-16T14:30:48Z")

</div>

Thanks, that was effectively the path I was going to take if nobody had done it before / if there were no easy api or .json page that returns the needed data.

---

<div class="post-metadata">

### Author: ![chrismalone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrismalone/32/506946_2.png) [@chrismalone](https://meta.discourse.org/u/chrismalone)
#### Post date: [2019年十一月22日 17:23 UTC](https://meta.discourse.org/t/get-badge-notification-from-api/106614/4 "2019-11-22T17:23:55Z")

</div>

这个问题解决了吗？你最后用的是哪个 API？
