Posting to sub category not working for me

(Michael Fomin) #1


Using the following curl command to post to our forum from bash

curl -X POST -H “Content-Type: application/json” --data @/tmp/json.json “$API_KEY&api_username=$UN

where json.json contains…

“title”: “test post”,
“category”: “cat/subcat”,
“raw”: “test post”

This works fine when sending to just a category, but when I try to send to a sub category, as shown above, the post is created without a category, so that everyone on the forum appears to see it

Anything special I need to set to get the post to correct be sent to a sub category

(Dean Taylor) #2

It’s best to use the category ID integer value as indicated by the docs here:

This is untested by me but I believe you can also use the “subcat” without the prefix “cat/” however there may be some issue if you have categories / subcategories with the same names.

I would stick with integer category ID numbers.

Discourse always posts in general using API
(Michael Fomin) #3

Thanks, using the category ID numbers worked :slight_smile: