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)
23 يناير 2025، 8:44ص
2
As always: If this is possible using UI, try Reverse engineer the Discourse API
إعجابَين (2)
nat
(Natalie T)
23 يناير 2025، 8:48ص
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)
pfaffman
(Jay Pfaffman)
23 يناير 2025، 3:31م
4
إعجاب واحد (1)
Canapin
(Coin-coin le Canapin)
23 يناير 2025، 4:37م
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.