I use Discourse API client for PHP (by @michaeld I guess) and I can’t find how to get a category name/slug with only with an ID.
I need it to display (slug and id) of all our categories and their sub-categories.
But when I get the categories list, the only information about sub-categories is their id.
site.json seems to be the way to get a list of all categories. Is it mentioned somewhere in docs.discourse.org? I was scouring the docs looking for a way to get the names of subcategories and couldn’t find it. Or is there a better way?
Making an API request to site.json is the correct way to get a list of categories that includes subcategories. Also, if you want private categories to be returned by the request to site.json, you need to make an authenticated API request.
I’m not seeing any reference to site.json in the docs. SInce categories.json doesn’t return subcategories, the description of the categories route in the docs isn’t correct, it says that the route returns all categories. I will fix that.