From what I know, if you are building categories with a script, I assume you are using JSON to add the categories. You would have to make some changes to the endpoint and the script. You can also refer to this documentation: Discourse Categories API.
However, Discourse is a powerful tool. You can check out this guide: Reverse Engineering the Discourse API. Since Discourse is backed by a complete JSON API, you can reverse engineer it, make the necessary alterations, and get it to work as needed.
A quick hint:
- Change the desired “Solved” setting manually in the UI.
- Inspect the network requests made by the browser to identify the exact API endpoint, request method (e.g.,
PUT
), and payload.
In python script it would look something like this:
payload = {
"enable_solved": True # Adjust this
}
response = requests.put(url, headers=headers, json=payload)
if response.status_code == 200:
print("Category updated")
else:
print(f"Failed: {response.status_code} - {response.text}")
update_category_settings(category_id=123)
PS: I’m not entirely sure about this, but I recently built some scripts, so this response is based on the things I have come across so far.