Delete Post from a Topic Using discourse API


(UserXtreamz) #1

Is it possible to delete post from a Topic using Discourse API?

Corresponding user can only delete their POST.


How can i delete a post using discourse api?
(Jeff Atwood) #2

Yes, if you can do it with the UI, you can do it via the API call. See the howto topic here titled “How to reverse engineer the Discourse API” for details.


(Allen - Watchman Monitoring) #5

@User143 Review this topic:

and and this text file specifically


(UserXtreamz) #6

I reviewed with this topic but i need to delete particular post from a topic.

I just tried with the following HTTP post but its not working

http://discourse.url.com/posts/1314/destroy_many/?api_key=test_beabcf136e&api_username=test_name

For delete we need to use this URL.Is it right?

destroy_many_posts DELETE /posts/destroy_many(.:format)

I don’t have any clear picture about this API URL. Can you please give the example for deleting the post

When I delete post from chrome using the delete button. I am getting the following header from chrome but i don’t know how can i call this DELETE post API

Remote Address:120.80.217.8:80
Request URL:http://discourse.url.com/posts/1314
Request Method:DELETE
Status Code:200 OK

(cpradio) #7

Look at it the info from Chrome again.

Request URL: http://discourse.url.com/posts/1314

The URL is the key here. It is accessing post id 1314. Now look at the Method

Request Method: DELETE

It is using DELETE, instead of POST, GET, etc.

Combine the two and it will delete the post (so long as you also pass in the API_KEY and API_Username


(system) #8

(Sam Saffron) #9