La chiamata all’API /categories.json restituisce solo le categorie di primo livello, almeno sul mio server. Posso leggere le sottocategorie tramite /c/<id>.json, ma non so come scoprire quegli ID.
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/lib/plugin-utilities.php at main · 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 parent_category_id from sites.json. I wonder why then categories.json is only root level.
Nota, ora puoi ottenere tutte le categorie e sottocategorie da categories.json con
/categories.json?include_subcategories=true