Using the API to get category_id by slug or name

Hi all

Is there a way to get a category’s id by either it’s name or slug?
I’ve got an admin area that needs to post to discourse when a record is edited.

I’ve found the /categories.json call but that will grow over time and I don’t want to have to iterate over the results.

Anyone got any ideas?

Thanks

Matt

https://meta.discourse.org/c/dev/show.json (Open in a new tab)

6 Likes

The JS uses the information at /site.json for the list of “all categories that I’m allowed to know about”. (It’s just inserted into the HTML instead of requested at that URL.)