Get Sub-Category name

javascript
api

(cpk) #1

I am looking to retrieve an actual Sub-Category name, similar to how I can retrieve regular Category names by hitting the “/categories.json” endpoint. I see the nested subcategory_ids, but no way to retrieve the name.

I have also tried “/c/5/6” which returns the nested category’s topics , but no sign of the name. Maybe I am missing something in the JSON, but it doesn’t seem like there is an easy way to do this. I may have to parse through the first post title, which I would like to avoid. Thanks a bunch everyone.


(Kane York) #2

You can get all of the categories in site.json: https://meta.discourse.org/site.json (open in new tab)


(Mittineague) #3

That link gives me a

The page you requested doesn’t exist or is private.

EDIT
It works for my forum where I’m a Mod so I’m guessing it’s a privilege thing.

Oh, and the new tab works for here too, Thanks :smile:


(cpk) #5

@riking. This is great. Thank you much.

Still wondering from a technical standpoint why sub-categories aren’t included in the “/categories.json” endpoint. I’m sure there is some reason for doing it this way. Thanks again.

-C