How can we create post/topic in Discourse using API


(UserXtreamz) #1


I need to create discourse topic using API . Anyone please provide the details to create discourse topic using API. Any javascript API available for this? . Using any url is it possible to post the topic to discourse like“post content”&category=“category name” ?

(Gautham N S) #2

Yes it is possible. You can go through the discourse code to find out all the details.
The url for posting is“Title”&category=“category”&raw=“Your post content here” by using HTTP post request. You have to provide the api key and username along with it.

(UserXtreamz) #3

Hi just tried with the following URL. But i am getting 500 internal error in desktop browser console“test Title”&category=“Uncategorized”&raw=“Your post content here”

Any problem with my URL?

(Gautham N S) #4

What was the error message you obtained when you tried? Did you do a HTTP POST request? Also, it needs to be a JSON request. So try adding .json to the request like this.“Title”&category=“category”&raw=“Your post content here”

(UserXtreamz) #5

Yes, i am using HTTP request i added posts.json. Now its showing the following Error

{“errors”:[“You are not permitted to view the requested resource.”],“error_type”:“invalid_access”}

Do i need to change any settings in discourse? or anything else?


Read api documentation

(UserXtreamz) #7

According to the API Doc i tried with the following URL'test Title’&category=‘Uncategorized’&raw=‘Your post content here’

But ia m getting {“errors”:[“You are not permitted to view the requested resource.”],“error_type”:“invalid_access”} in browser. What is the actual issue?


For topic test this

(UserXtreamz) #9

Yes, But its opening the window for creating topic. How can i create new content using HTTP request?

I need to post the content to discourse through this URL .is it possible?


(UserXtreamz) #12

Any API available to create topic like this:

(Aarskin) #13

@User143: see the linked reply here, where I had the same issue. I found removing the quotes from my query string solved my issue.

Not sure if you automatically get notifications on linked replies, so I’m redundantly posting this here.

(system) #14