You’re right, but I just saw that in fact Discourse doesn’t allow duplicate category names even with different slugs.
I can indeed check if the category name is already present in /categories.json, but what about string cleaning, escaping, and such? I can’t be 100% sure the name given by the user in my app front-end will be the same as the one Discourse would use when creating the category.
Example: Would 🎹 Category with an emoji appear as so in /categories.json or will the emoji be stripped? If not now, I can’t be sure it won’t be the case tomorrow. Depends on so many factors, from the app to the server.
The only way I can be sure is to feed Discourse this name and get the response. As of today, the only way is to try to create it, and therefore having side-effect.
My feature proposal still stands
It would be great to have a side-effect free way to check if a category name is available.
Allowing duplicate category names (restricting unicity to slugs) is another request.