/categories.json API call returns only top-level categories, at least on my server. I can read subcategories using
/c/<id>.json but I don’t know how to discover those IDs.
To get all categories and subcategories from the API, you need to make a request to
/site.json. If you don’t mind looking at PHP/WordPress code, there’s an example API request to get all categories here: wp-discourse/plugin-utilities.php at master · discourse/wp-discourse · GitHub.
Terrific, thank you!
I notice that the category record returned doesn’t have a parent category. If it did, a flattened list from
/catgories.json of all categories would be I think a less-surprising result, as opposed to only the root level.
I see that subs have
sites.json. I wonder why then
categories.json is only root level.