# Top Referred Topics and Trending search via API

**URL:** https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142
**Category:** Feature
**Created:** [11 ביולי,‏ 2018,‏ 11:48pm UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142 "2018-07-11T23:48:50Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [11 ביולי,‏ 2018,‏ 11:48pm UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/1 "2018-07-11T23:48:50Z")

</div>

It’d be super great if these was available via an API call that could be iterated over time. That way we use it to identify trending topics/content.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [11 ביולי,‏ 2018,‏ 11:54pm UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/2 "2018-07-11T23:54:46Z")

</div>

If you can find the data that you are looking for at `/admin/reports`, you can query the report through the API. Try `/admin/reports/trending_search.json?category_id=all` for trending search terms. You can set the category\_id and search period as parameters.

---

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [11 ביולי,‏ 2018,‏ 11:59pm UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/3 "2018-07-11T23:59:52Z")

</div>

Ahh didn’t realise that was an open API call 😃

---

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [12 ביולי,‏ 2018,‏ 12:02am UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/4 "2018-07-12T00:02:07Z")

</div>

Same thing for `admin/reports/top_referred_topics.json?category_id=all`!

---

<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: [12 ביולי,‏ 2018,‏ 1:28am UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/5 "2018-07-12T01:28:25Z")

</div>

Everything you see in Discourse is an API by definition, as we are a JavaScript application that runs in the browser. See [Reverse engineer the Discourse API](https://meta.discourse.org/t/how-to-reverse-engineer-the-discourse-api/20576)

---

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [17 ביולי,‏ 2018,‏ 11:57pm UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/6 "2018-07-17T23:57:45Z")

</div>

Side note, this feels a bit like saying it’s self documenting code and I should just go figure it out. As a customer, rather than being told that it’d be great to have something added to the docs if it’s being added as an API. Even if it’s just a “this exists here” rather than a full breakdown, it’s a start.

As an open source community member and user, I totally get it’s open and accessible and I would be happy to make more PRs on the docs to expand what’s there.

It’s just finding the tricky balance between these two 🙂

---

<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: [17 ביולי,‏ 2018,‏ 11:58pm UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/7 "2018-07-17T23:58:59Z")

</div>

The problem with documentation is that it tends to be speculative; my recommendation is to look at the network requests for _the exact thing you want to do in the UI_ which is quite surgically precise 🧐

---

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [18 ביולי,‏ 2018,‏ 12:36am UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/8 "2018-07-18T00:36:20Z")

</div>

I can totally do this, it’s not a big deal for me technically.

As a customer, my feedback is that it doesn’t feel right that you are telling me I need to analyse network calls of the code in the browser to figure out functionality that could be documented.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [18 ביולי,‏ 2018,‏ 1:40am UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/10 "2018-07-18T01:40:03Z")

</div>

> [@Mark\_Walkom](#):
>
> Same thing for `admin/reports/top_referred_topics.json?category_id=all` !

We are going to expose `/admin/reports` properly once it is ready and the reports inside it are properly documented and corrected. I think you just have to hold tight here while we clean stuff up.

---

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [18 ביולי,‏ 2018,‏ 2:53am UTC](https://meta.discourse.org/t/top-referred-topics-and-trending-search-via-api/92142/11 "2018-07-18T02:53:19Z")

</div>

Ahh great, thanks for the heads up 🙂
