I’m trying to understand how to use the Discourse API.
In the URLs below, I’m guessing that term refers to a period or duration. This is based on erm=after:2016-01-01%20before:2017-01-01 etc. But I’m unclear what term=API refers to. Can anyone clarify?
There are actually two search endpoints you can hit /search.json?q= and /search/query?term=
term just means search term and does not refer to period or duration.
For understanding the search API it would be best to follow How to reverse engineer the Discourse API and perform the searches you are intending to do via the API and see how the UI makes the same API requests.
Actually, I’d like the grab the entire contents of a page (in my case, a list of topics in a category, see Obtaining a list of topics from a category). I don’t want to go page by page if it’s not necessary. And I don’t think reverse engineering this would work, because Discourse just expands the page as you scroll down. There is no option that I am aware of to show the whole page. Is there a way to do this?
There is no single API call that will fetch ALL of the topics in the category. You will have to make multiple api calls. This is because a category could have 1 million+ topics and that could be a huge query and affect the performance of your site. When you reverse engineer the scrolling you can see how the discourse UI makes the api calls for more topics and you can replicate that behavior in your api.
Depending on what you are trying to achieve you can also use the data explore query to get the number of topics in a category and make an api call to that saved query.