How do I get subcategory details by Slug using Discourse API?

Hi,
I created a parent category with slug “testparent” and a sub category with slug “testsub”. When I use /c/testparent/show.json, it could get the detail of the parent category properly. But when I use /c/testsub/show.json, it gives me below error

What is the api to get subcategory details? Thanks.

I think the canonical URL for that is by ID, so /c/ID/show.json will work with both parent and children categories.

You can do the slug → ID translation by parsing the response from /site.json.

4 Likes

Thanks a lot for your help. Just an update for what I found by reverse engineering minutes ago. I happen to see that /c/testparent/testsub/find_by_slug.json could get me subcategory details by slug.

2 Likes