Creating new topic in subcategory via API


(Nordize) #1

I tried using &category=subcategory-slug but it ends up in the uncategorized category. I also tried to use &category=category-slug/subcategory-slug and got the same thing. It works fine if it’s a main category. Is it possible to create a new topic in a subcategory? If yes, what’s the syntax?


(Joshua Rosenfeld) #2

Assuming the API takes the same parameters as create topic via URL (no idea why it wouldn’t) - then you should be using the category name, not the slug.

Source:


(Nordize) #3

I just wanted to reply to say that I tried the category name too and that failed too. It had spaces (I used the url encoded version with both + and %20) but now I renamed it to something without spaces and it works. I then renamed it back to something with spaces and it still works … sorry for wasting your time :confused:


(cpradio) #4

Based on the docs, the category parameter is an integer, you need to use the category id there.

http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1posts%2Fpost


(Nordize) #5

It certainly worked with the category name (string) though.