Shubham_G
(Shubham_G)
January 23, 2025, 7:46am
1
I have found an API which can list all the topics from a specific subject (whose slug is “mlt-kb”) from between a certain date range. Here is the endpoint:
https://{default_host}/search.json?q=%23courses%3Amlt-kb%20after%3A2024-09-24%20before%3A2024-12-29
But this URL doesn’t list all topics. It only lists the first 50 topics. There must be some other parameter like offset or page …but I cannot understand how to add them to this URL . Can someone figure this out?
Thanks in advance!
thoka
(Thomas Kalka)
January 23, 2025, 8:44am
2
As always: If this is possible using UI, try Reverse engineer the Discourse API
2 Likes
nat
(Natalie T)
January 23, 2025, 8:48am
3
You can use this - https://docs.discourse.org/#tag/Search/operation/search (scroll down!)
You’ll see that besides ?q
, we also have ?page
, so…
https://{default_host}/search.json?q=%23courses%3Amlt-kb%20after%3A2024-09-24%20before%3A2024-12-29&page=1
2 Likes
pfaffman
(Jay Pfaffman)
January 23, 2025, 3:31pm
4
1 Like
CocoQuark
(Coconut Flavored Quark)
January 23, 2025, 4:37pm
5
There’s a script example that loops page results here:
You don’t need an API key to do searches.
I’m not sure having an API key could help you resolve your issue more easily.
Here’s an example Python script that loops my posts (1 post every 3 sec) on meta and returns those having the substring upload:// in the raw content:
import requests
import time
def fetch_posts(page):
url = f"https://meta.discourse.org/search.json?q=%40cocoquark&page={page}"
response = requests.get(url)
return response.json()
def fetch_post_content(pos…
But as Jay said, depending on your goal, using data explorer might be a way better solution if you’re admin.