# Hoe de topics\_with\_no\_response.json API te bevragen met filters

**URL:** https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694
**Category:** Support
**Created:** [16 juni 2023 om 22:34 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694 "2023-06-16T22:34:24Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jjyao](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jjyao](https://meta.discourse.org/u/jjyao)
#### Post date: [16 juni 2023 om 22:34 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/1 "2023-06-16T22:34:24Z")

</div>

I know that for each admin report, there is a `.json` API to fetch the data. The report I’m interested in is `topics_with_no_response` and I was able to filter by category via `https://xxx.com/admin/reports/topics_with_no_response?end_date=2023-06-16&filters=%7B%22category%22%3A7%2C%22include_subcategories%22%3Atrue%7D&mode=table&start_date=2023-06-14`. However if I switched to the json endpoint via `https://xxx.com/admin/reports/topics_with_no_response.json?end_date=2023-06-16&filters=%7B%22category%22%3A7%2C%22include_subcategories%22%3Atrue%7D&mode=table&start_date=2023-06-14`, it doesn’t return the data.

Do we have different syntax to query these two endpoints?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [16 juni 2023 om 22:42 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/2 "2023-06-16T22:42:06Z")

</div>

You need to `POST` instead of `GET` for some weird reason.

---

<div class="post-metadata">

### Author: ![jjyao](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jjyao](https://meta.discourse.org/u/jjyao)
#### Post date: [17 juni 2023 om 03:56 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/3 "2023-06-17T03:56:52Z")

</div>

Hi @RGJ,

Could you give me an example of the POST request? What should be the body? I tried to just change GET to POST with the same URL but it seems doesn’t work.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [17 juni 2023 om 08:05 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/4 "2023-06-17T08:05:44Z")

</div>

You will obviously need to pass the query parameters (i.e. everything after the `?`) as the POST data.

See also [Run Data Explorer queries with the Discourse API](https://meta.discourse.org/t/run-data-explorer-queries-with-the-discourse-api/120063)

---

<div class="post-metadata">

### Author: ![jjyao](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jjyao](https://meta.discourse.org/u/jjyao)
#### Post date: [18 juni 2023 om 04:27 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/5 "2023-06-18T04:27:12Z")

</div>

When I switched to POST and pass all the query parameters as the POST data, I got “Page Not Found”. However I was able to use POST to run [data explorer](https://meta.discourse.org/t/32566?silent=true) queries. Do you have any ideas? Thanks!

---

<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: [18 juni 2023 om 04:57 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/6 "2023-06-18T04:57:34Z")

</div>

Have a look at [Reverse engineer the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576). When I try that approach for the Topics With no Response report, I’m seeing it make `GET` requests similar to:

`http://forum.example.com/admin/reports/bulk?reports%5Btopics_with_no_response%5D%5Bfacets%5D%5B%5D=prev_period&reports%5Btopics_with_no_response%5D%5Bstart_date%5D=2022-02-01&reports%5Btopics_with_no_response%5D%5Bend_date%5D=2023-06-17&reports%5Btopics_with_no_response%5D%5Blimit%5D=50`

You can get the encoded query params from the Network tab of your browser’s inspector. With that URL, you should be able to do something like:

```plaintext
curl -X GET "http://localhost:4200/admin/reports/bulk.json?reports%5Btopics_with_no_response%5D%5Bfacets%5D%5B%5D=prev_period&reports%5Btopics_with_no_response%5D%5Bstart_date%5D=2022-05-16&reports%5Btopics_with_no_response%5D%5Bend_date%5D=2022-09-10&reports%5Btopics_with_no_response%5D%5Blimit%5D=50" \
-H "Api-Key: $api_key" \
-H "Api-Username: system"

```

You will need to set `api_key` to an All Users Global API key - I don’t think there’s a specific scope that can be used for the reports.

Note that you need to add the `json` extension to the URL (`http://localhost:4200/admin/reports/bulk.json`)

---

<div class="post-metadata">

### Author: ![jjyao](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jjyao](https://meta.discourse.org/u/jjyao)
#### Post date: [20 juni 2023 om 04:06 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/7 "2023-06-20T04:06:56Z")

</div>

Thanks @simon, that works!!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [20 juli 2023 om 04:07 UTC](https://meta.discourse.org/t/how-to-query-the-topics-with-no-response-json-api-with-filters/268694/8 "2023-07-20T04:07:20Z")

</div>

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