Using API to create topic in a specific subcategory


#1

I have been trying to add a daily topic through the api using a bash script. But when I try to use the sample from the API documentation it simply puts the topic in no category.

I have tried using the following formats…

curl -X POST -d title="My Topic" -d raw="This is the body" -d category="maincat/subcat" http://myurl/posts?api_key=mykey&api_user=myusername

and also (where 3 is a subcategory)

curl -X POST -d title="My Topic" -d raw="This is the body" -d category_id="3" http://myurl/posts?api_key=mykey&api_user=myusername

But both do not work. Any ideas?


(cpradio) #2

From what I can tell, you’d use category=“3”

Here is what the Network tab logged during my test


#3

@cpradio Yep, that worked like a charm. Thanks.

What is weird though is that when editing a topic and changing it’s category the form data parameter appeared as category_id. Should this be or will this be standardized in future api revisions?